timer = null;
IMG = null;
NewWindow = null;
function ViewImage(Isrc,title) {
	IMG = new Image;
	IMG.src = Isrc;
	if (typeof(title)=="undefined" || title=="") title="Gallery";
	if (NewWindow) { NewWindow.close(); }
	if (NewWindow==null || NewWindow.closed) {
		settings=
		 "left="+50+","
		 +"top="+50+","
		 +"width="+640+","
		 +"height="+480+","
		 +"toolbar=no,"
		 +"location=no,"
		 +"directories=no,"
		 +"status=no,"
		 +"menubar=no,"
		 +"scrollbars=no,"
		 +"resizable=yes"
		 NewWindow = window.open("",'Gallery',settings);
	}
	NewWindow.document.open();
	NewWindow.document.clear();
	NewWindow.document.write(
 	 "<html><head><title>"+ title +"</title>"
	+"</head>\n"
	+"<body topmargin=0 leftmargin=0 bgcolor=\"#FFFFFF\" onclick=\"window.close();\">\n"
	+"<table border=\"0\" cellpadding=\"0\" cellspacing=0><tr><td align=\"center\" valign=\"middle\"><img src=" + IMG.src + " border=0 alt=\""+title+"\"></td></tr></table>\n"
	+"</body>\n"
	+"</html>"
	);
	NewWindow.document.close();
	NewWindow.focus();
	timer = setInterval("resize()",250);
}

function resize() {
    if(!IMG.complete){ return; }
    clearInterval(timer);
	resizeWindowTo(NewWindow,(IMG.width-18+30),(IMG.height-18+50));
	IMG = null;
}

function resizeWindowTo(WindowObject,w,h) {
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			WindowObject.outerWidth=w;
			WindowObject.outerHeight=h;
		}
		else WindowObject.resizeTo(w,h);
	}
}