function popupImage(imageUrl)	{
	// Open new window with images
	var img = new Image();
	img.src = imageUrl;

	var imgHeight = img.height;
	var imgWidth = img.width;
	// It appears that JS does not register the width & height the first time the webpage is loaded. Instead of hard-coding or inserting a delay, standard values are used.
	if (!imgHeight || imgHeight == 0) imgHeight = 1024;
	if (!imgWidth  || imgWidth == 0) imgWidth = 768;
	// Center the window
	var xpoint = (screen.width - imgWidth) / 2;
	var ypoint = (screen.height - imgHeight) / 2;
	imgWidth += 20;
	imgHeight += 20;

//	imgWin = window.open(imageUrl, "_blank", "height=" + imgHeight + ",width=" + imgWidth + ", left=" + xpoint + ",top=" + ypoint + ",status=no,toolbar=no,menubar=no,location=no, scrollbars=auto");
	imgWin = window.open("about:blank", "_blank", "height=" + imgHeight + ",width=" + imgWidth + ", left=" + xpoint + ",top=" + ypoint + ",status=no,toolbar=no,menubar=no,location=no, scrollbars=no, resizable=yes");



	with (imgWin.document){
		writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
		writeln('<html><head><title>www.bit-kit.com</title><style type="text/css">body{margin:0px;}</style>');
		writeln('<sc'+'ript type="text/javascript">');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
				writeln('isNN=(navigator.appName=="Netscape")?1:0;');
				writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;');
			writeln('}');

			writeln('function getIEVersionNumber() {');
				writeln('var ua=navigator.userAgent;');
				writeln('var MSIEOffset=ua.indexOf("MSIE ");');
				writeln('if (MSIEOffset==-1) return 0;');
				writeln('else return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));');
			writeln('}');

			writeln('function reSizeToImage(){');
				writeln('if (isIE){');
					//writeln('window.resizeTo(300,300);');
					//writeln('width=300-(document.body.clientWidth-document.images[0].width);');
					//writeln('height=300-(document.body.clientHeight-document.images[0].height);');
					writeln('if (getIEVersionNumber()>=7)');
						writeln('window.resizeTo(document.images[0].width + 12, document.images[0].height + 83);');
					writeln('else');
						writeln('window.resizeTo(document.images[0].width + 12, document.images[0].height + 51);');
				writeln('}');
				writeln('if (isNN){');       
					writeln('window.innerWidth=document.images["imgWin"].width;');
					writeln('window.innerHeight=document.images["imgWin"].height;');
				writeln('}');
			writeln('}');

			writeln('function doTitle(){document.title="'+""+'";}');

		writeln('</sc'+'ript>');
		writeln('</head><body bgcolor="#000000" onload="reSizeToImage();">')
		writeln('<img name="imgWin" src="'+imageUrl+'" style="display:block" alt="" /></body></html>');
		close();		
	}
	
}  


