function popUpImageKill()
{
    if (typeof(subwin)=='undefined')
     return;
    if (typeof(subwin.closed)=='undefined')
     return;
    if (subwin.closed==true)
     return;
    subwin.close();
}

function popUpImage(targetUrl, title, width, height)
{
	popUpImageKill();

		if(!width){width=640;}
		if(!height){height=480;}
		
		swleft  = Math.round((self.screen.width - width)/2);
    	swtop   = Math.round((self.screen.height - height)/3);
		
	subwin=window.open("","","height="+height+",width="+width+", left = "+swleft+", top = "+swtop+", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no");

     	subwin.document.write('<html><head><title>'+title+'</title><style>body {margin: 0; padding: 0;background: #FFFFFF;}</style></head>\n');
     	subwin.document.write('<body><img src="'+targetUrl+'" width="'+width+'"height="'+height+'" alt="" onclick="window.close();" /></body>\n');
     	subwin.document.write('</html>\n');

	subwin.focus();
}
