var x = 0;
var y = 0;
var enlargedwindow;
function EnlargeImage(image) {
	var output = "";
	//enlargedwindow = window.open("","GHEnlargedScreenshot","height=640,width=480,resize=yes,scrolling=no");
	enlargedwindow = window.open("","GHEnlargedScreenshot","height=640,width=480,toolbars=no,maximize=yes");
	
	output += "<script language=javascript>"

	output += "function preloadimage(imagestring){"
	output += "newimage=new Image();"
	output += "newimage.src=imagestring;"
	output += "}"


	output += "function ResizePopup() { " 
	output += "	 x = 30 + parseInt(document.images['image1'].width);"
	output += "	 y = 50 + parseInt(document.images['image1'].height);"

	//output += "alert(x + ' ' + y);";
	
	output += "			if (x < 200 || y < 80) {"
	output += "			x = 600;"
	output += "			y = 600;"
	output += "			}"

	output += "		window.resizeTo(x,y);"
	output += "		}"	
	output += "		"
	output += "		function CenterPopup() {"
	output += "			window.moveTo((screen.availWidth-x)/2,(screen.availHeight-y)/2);"
	output += "		}"
	output += "</script>"

    output += "<body onblur='self.close();' onload=preloadimage('"+image+"') leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor='#FFFFFF'>"
	output += '<table width = 480 height=640 style="width: 100%; height: 100%; background-image: url(\'loading.gif\'); background-repeat: no-repeat; background-position: 50% 50%;" colspacing=0 colpadding=0>'
	output += "<tr><td align=center valign=middle>"
	output += '<a href="javascript:self.close();"><img src="'+image+'" name="image1" alt="Click to Close" border=0></a>'
	output += "</td></tr>"
	output += "</table>"
	
	output += "</BODY>"
	output += "</HTML>"

	output += "<script language=javascript>"
	output += "		self.focus();ResizePopup();CenterPopup();"
	output += "</script>"
	
	enlargedwindow.document.write(output);
	enlargedwindow.document.close();
}

