function popUpImageKill()
	{
		if (typeof(subwin)=='undefined')
			return;
		if (typeof(subwin.closed)=='undefined')
			return;
		if (subwin.closed==true)
			return;
		subwin.close();
	}

function popUpImage(element,width,height)
	{
		popUpImageKill();
		
		href = element.href;
		title = element.getElementsByTagName('img')[0].alt;

		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: #E0E0E0 url("img/preloader.gif") no-repeat center;}</style></head>\n');
     	subwin.document.write('<body><img width="'+width+'"height="'+height+'" src="'+href+'" alt="'+title+'" title="" onclick="window.close();"></body>\n');
     	subwin.document.write('</html>\n');

		subwin.focus();
	}
