var im,w,h,mousex,mousey,attempt,photowin;
document.write('<DIV ID="photoload" STYLE="position:absolute;visibility:hidden;padding:1px;font:menu;border:1px solid black;background:#FFFFDD">&nbsp;Loading image...&nbsp;</DIV>');
document.onmousedown=getxy;
function getxy(e) {
	if (!document.all) { mousex=e.pageX; mousey=e.pageY; }
	else { mousex=event.clientX; mousey=event.clientY; }
	mousey+=20;
}
function photopop(file) {
	if (photowin) if (!photowin.closed) photowin.close();
	with (document.getElementById("photoload").style) { left=mousex; top=mousey; visibility="visible"; }
	im = new Image();
	im.src = file;
	attempt=1; checkload();
}
function checkload() {
	if (im.complete || im.width>32) {
		s = screen;
		w = 480; x = (s.width-w)/2 - (s.width-s.availWidth);
		h = 360; y = (s.height-h)/2 - (s.height-s.availHeight);
		document.getElementById("photoload").style.visibility="hidden";
		photowin = window.open("plan.htm","plan","width="+w+",height="+h+",top="+y+",left="+x);
	} else {
		if (attempt < 100) {
			attempt++;
			window.setTimeout("checkload()",100);
		} else {
			document.getElementById("photoload").style.visibility="hidden";
			alert('The picture could not be loaded after 10 seconds');
		}
	}
}

