popwin=null;

pStart='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n<html><head><title>Týden - fotogalerie</title></head><body style="margin: 0; padding: 0;">';

pGemius = '<!-- (C)2000-2008 Gemius SA - gemiusAudience / tyden.cz / Ostatni -->';
pGemius += '<script type="text/javascript">';
pGemius += '<!--//--><![CDATA[//><!--';
pGemius += 'var pp_gemius_identifier = new String(\'pxXlDzNq5SWy59iQ5eX3u8QKT.Q_pOv9OsUB3zQUTof.z7\');';
pGemius += '//--><!]]>';
pGemius += '</script>';
pGemius += '<script type="text/javascript" src="/ajax/xgemius.js"></script>';

// pGemius = '';

pEnd = pGemius + '</body></html>';

function popopen (url)
{
	popwin=window.open ('','a','location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,status=no',true);
	popwin.document.write ( pStart + '<img src="' + url + '" id="image" style="cursor:pointer;" alt="Zavřít" title="Zavřít" onclick="window.close();" />' + pEnd );
	popwin.document.close();
	img=popwin.document.getElementById('image');
	img.onload=function ()
	{
		do
		{} while (!img.width);
		popwin.focus();
		popwin.resizeTo (1000,800);
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' )
		{
			//Non-IE
			myWidth = popwin.innerWidth;
			myHeight = popwin.innerHeight;
		}
		else if( popwin.document.documentElement && ( popwin.document.documentElement.clientWidth || popwin.document.documentElement.clientHeight ) )
		{
			//IE 6+ in 'standards compliant mode'
			myWidth = popwin.document.documentElement.clientWidth;
			myHeight = popwin.document.documentElement.clientHeight;
		}
		else if( popwin.document.body && ( popwin.document.body.clientWidth || popwin.document.body.clientHeight ) )
		{
			//IE 4 compatible
			myWidth = popwin.document.body.clientWidth;
			myHeight = popwin.document.body.clientHeight;
		}
		
		if(img.height > 700) { myWidth -= 20; }
		
		popwin.resizeBy (-(Math.abs(img.width-myWidth)),-(Math.abs(img.height-myHeight)));
	}
	popwin.onunload=function ()
	{ this.opener.popwin=null; }
}

function popopenWithTitle(url,title)
{
	var popisek = '<div style="text-align:center; height:60px; margin:10px; color:#000000; font-family:Arial,sans-serif; font-size:12px; background:#f6f6f6; line-height:20px;">' + title + '</div>';
	
	popwin=window.open ('','a','location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no,status=no',true);
	popwin.document.write ( pStart + popisek + '<img src="' + url + '" id="image" style="cursor:pointer;" alt="Zavřít" title="Zavřít" onclick="window.close();" />' + pEnd );
	popwin.document.close();
	img=popwin.document.getElementById('image');
	img.onload=function ()
	{
		do
		{} while (!img.width);
		popwin.focus();
		popwin.resizeTo (1000,800);
		var myWidth = 0, myHeight = 0;
		if( typeof( window.innerWidth ) == 'number' )
		{
			//Non-IE
			myWidth = popwin.innerWidth;
			myHeight = popwin.innerHeight;
		}
		else if( popwin.document.documentElement && ( popwin.document.documentElement.clientWidth || popwin.document.documentElement.clientHeight ) )
		{
			//IE 6+ in 'standards compliant mode'
			myWidth = popwin.document.documentElement.clientWidth;
			myHeight = popwin.document.documentElement.clientHeight;
		}
		else if( popwin.document.body && ( popwin.document.body.clientWidth || popwin.document.body.clientHeight ) )
		{
			//IE 4 compatible
			myWidth = popwin.document.body.clientWidth;
			myHeight = popwin.document.body.clientHeight;
		}
		popwin.resizeBy (-(Math.abs(img.width-myWidth)),-(Math.abs(img.height+80-myHeight)));
	}
	popwin.onunload=function ()
	{ this.opener.popwin=null; }
}
