	function popUpImageKill()
	{
		if (typeof(subwin)=='undefined')
			return;
		if (typeof(subwin.closed)=='undefined')
			return;
		if (subwin.closed==true)
			return;
		subwin.close();
	}
	
	function popupVT(element,title,width,height,url){
		popUpImageKill();
		subwin=window.open(element.href,title);
		subwin.focus();
		
	}

	function popUpImage(element,width,height,basedir)
	{
		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><div style="position: relative" onclick="window.close();"><img style="position: absolute; top: 0; left: 0; z-index: 1;" src="'+href+'" width="'+width+'" height="'+height+'" alt="'+title+'" /><img style="position: absolute; top: 0; left: 0; z-index: 2;" src="'+basedir+'images/empty.gif" width="'+width+'" height="'+height+'" alt="'+title+'" /></div></body>\n');
     	subwin.document.write('</html>\n');
     	subwin.document.close();

		subwin.focus();
	}
	
	function popUp(element,width,height)
	{
		href = element.href;

		if(!width){width=500;}
		if(!height){height=410;}
		
		swleft = Math.round((self.screen.width - width)/2);
    	swtop  = Math.round((self.screen.height - height)/3);
		
		subwinv=window.open(href,"","height="+height+",width="+width+", left = "+swleft+", top = "+swtop+", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no");

		subwinv.focus();
	}