function ImagePicker(objName)
{
	var divCreated;
	var doIframe;
	var pickerName = objName;
	
	var pickerDiv;
	var iframeDiv;
	
	var imageElem;
	var selectElem;
	var pickElem;
	
	function PickImage(elem)
	{
		if (!divCreated) { CreateDiv(); }
		var picker = getObject('imageselector');
		if (doIframe) var iframe = getObject('isiframe');
		if (picker.style.display == 'block')
		{
			picker.style.display = 'none';
			if (doIframe) iframe.style.display = 'none';
			return;
		}
		picker.style.top = getAbsoluteOffsetTop(elem) + 20 + "px";
		picker.style.left = getAbsoluteOffsetLeft(elem) + "px";
		if (doIframe)
		{
			iframe.style.top = picker.style.top;
			iframe.style.left = picker.style.left;
			iframe.style.width = "211px";
			iframe.style.height = "137px";
			iframe.style.display = 'block';
		}
		picker.style.display = 'block';
		
		pickElem = elem;
	}

	// Public Method Setters
	this.PickImage = PickImage;
	this.SelectImage = SelectImage;
	this.ShowImage = ShowImage;
	this.DoIframe = DoIframe;
	
	function DoIframe(doiframe) { doIframe = doiframe; }
	
	function CreateDiv()
	{
		if (!document.createElement) { return; }
		pickerDiv = document.createElement('div');
		if (typeof(pickerDiv.innerHTML) != 'string') { return; }
		pickerDiv.id = 'imageselector';
		pickerDiv.style.position = 'absolute';
		pickerDiv.style.display = 'none';
		pickerDiv.style.backgroundColor = "white";
		pickerDiv.style.width = "210px";
		pickerDiv.style.zIndex = 5;
		var html = ' \
		<div class="boxtop"> \
			<div class="boxtopleft">&nbsp;</div> \
			<div class="boxtopright">&nbsp;</div> \
			<span class="boxtoptext">Select</span> \
		</div> \
		<div> \
			<div class="boxmiddle"> \
				<table width="180"> \
					<tr> \
						<td width="50%" align="center"> \
							<select size="7" onchange="' + pickerName + '.ShowImage()"> \
								<option value="none">None</option> \
								<option value="001.gif">001.gif</option> \
								<option value="002.gif">002.gif</option> \
								<option value="003.gif">003.gif</option> \
								<option value="004.gif">004.gif</option> \
								<option value="005.gif">005.gif</option> \
								<option value="006.gif">006.gif</option> \
								<option value="007.gif">007.gif</option> \
								<option value="008.gif">008.gif</option> \
								<option value="009.gif">009.gif</option> \
								<option value="010.gif">010.gif</option> \
								</select> \
						</td> \
						<td width="50%" align="center"> \
							<a style="cursor:pointer" onclick="' + pickerName + '.SelectImage();"> \
								<img id="isimage" style="border:1px solid #98AAB1" src="http://www.genmyspace.com/other/profile/bgs/spacer.gif" width="80" height="80" /> \
								<br /> \
								<strong>Select</strong> \
							</a> \
						</td> \
					</tr> \
				</table> \
			</div> \
		</div> ';

		pickerDiv.innerHTML = html;
		document.body.appendChild(pickerDiv);
	
		if (doiframe)
		{
			iframeDiv = document.createElement('iframe');
			iframeDiv.id = 'isiframe';
			iframeDiv.style.position = 'absolute';
			iframeDiv.style.display = 'none';
			iframeDiv.style.border = '0';
			iframeDiv.style.zIndex = 4;
			document.body.appendChild(iframeDiv);
		}
		
		imageElem = pickerDiv.getElementsByTagName("img")[0];// alert(imageElem.id);
		selectElem = pickerDiv.getElementsByTagName("select")[0];
		
		divCreated = true;
	}
	
	function ShowImage()
	{
		if (selectElem.value != "none")
			imageElem.src = "http://www.genmyspace.com/other/profile/bgs/" + selectElem.value;
		else
			imageElem.src= "http://www.genmyspace.com/other/contact-profile/images/spacer.gif";
	}
	
	function SelectImage()
	{
		if (selectElem.value != "none")
			var imageurl = "http://www.genmyspace.com/other/profile/bgs/" + selectElem.value;
		else
			var imageurl = "http://www.genmyspace.com/other/profile/bgs/spacer.gif";
			
		if (pickElem != null)
			eval(pickElem.title);

		pickerDiv.style.display = "none";
		if (doIframe)
            iframeDiv.style.display = 'none';
		
		pickElem = null;
	}
}


		var imagepicker = new ImagePicker("imagepicker");
		imagepicker.DoIframe(browser == "Internet Explorer");

