	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;
		if (element.getElementsByTagName('img').length > 0)
		{
			// obrazky
			title = element.getElementsByTagName('img')[0].alt;
		} else
		{
			// odkazy
			title = element.textContent;
		}

		if(!width){width=500;}
		if(!height){height=410;}
		
		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('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">');
     	subwin.document.write('<head><title>'+title+'</title><style type="text/css">body{margin:0;padding:0;background:#F9F9F9 no-repeat center;}</style></head>\n');
     	subwin.document.write('<body><p><img width="'+width+'"height="'+height+'" src="'+href+'" alt="'+title+'" title="" onclick="window.close();" /></p></body>\n');
     	subwin.document.write('</html>\n');
     	subwin.document.close();

		subwin.focus();
	}