var preload = 0;

function popupImage(url, text, style)
{
	if (!preload)
	{
		preload = new Image();
		preload.src = url;
	}
	if (!preload.complete)
	{
		window.setTimeout('popupImage("' + url + '","' + text + '","' + style + '")', 200);
		return false;
	}
	style = "background: azure; " + style;
	w = window.open("", "w", "menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
	if (w)
	{
		w.document.open();
		w.document.write("<html>\n");
		w.document.write("	<head>\n");
		w.document.write("		<title>" + text + "</title>\n");
		w.document.write("	</head>\n");
		w.document.write("	<body id=\"body\" style=\"margin: 0; " + style + "\" onClick=\"window.close()\">\n");
		w.document.write("		<img style=\"margin: 5px;\" src=\"" + url + "\" alt=\"" + text + "\" />\n");
		w.document.write("	</body>\n");
		w.document.write("</html>\n");
		w.document.close();

		netscape = (navigator.appName == "Netscape") ? true : false;
		iWidth = netscape ? w.innerWidth : w.document.body.clientWidth;
		iHeight = netscape ? w.innerHeight : w.document.body.clientHeight;
		w.resizeBy(w.document.images[0].width - iWidth + 10, w.document.images[0].height - iHeight + 10);
		w.moveTo((screen.width - w.document.width) / 2, (screen.height - w.document.height) / 2);
		w.focus();
		preload = 0;
		return false;
	}
	else
		return true;
}
