// Open new window
// MHA comment - vyuzivaji stranky WChD a Char. akce

function show(anch,title)	{
	return popImage(anch.href,title);
}

// Open new window
// MHA comment - vyuzivaji stranky Naroz. oslava a HappyMeal

function newWin(src,winName,w,h,prop,lp,tp) {
	winLeft = (!lp)? (screen.width - w) / 2 : lp;
	winTop = (!tp)? ((screen.height - h) / 2) - 28 : tp;
	winProp = (!prop)? 'menubar=no,resizable=no,scrollbars=0,status=no,toolbar=no,locationbar=no,directories=no' : prop;
	winProp += ',width='+w+',height='+h+',left='+winLeft+',top='+winTop;
	Win = window.open(src,winName,winProp);
	Win.focus();
}

// Open new window for image
// MHA comment - vyuzivaji stranky McD Cup 10. rocnik a Produkty Kvalita

function imgWin(imgsrc,imgname,w,h) {
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
	newWin('','foto',w,h);
	if(isOpera) {
		if (w != Win.innerWidth || h != Win.innerHeight) { 
			Win.resizeTo(w,h); 
		}
	}
	else if(!is.ns4) {
		if (w != Win.document.body.clientWidth || h != Win.document.body.clientHeight) { Win.resizeTo(w,h); }
	}
	else {
		if (w != Win.innerWidth || h != Win.innerHeight) { Win.resizeTo(w,h); }
	}
	Win.document.open();
	Win.document.write('<html>\n');
	Win.document.write('<head>\n');
	Win.document.write('	<title>'+imgname+'</title>\n');
	Win.document.write('	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">\n');
	Win.document.write('</head>\n');
	Win.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">\n');
	Win.document.write('<a href="javascript:window.close()"><img src="'+imgsrc+'" width="'+w+'" height="'+h+'" border="0" alt="[kliknutím zavři]"></a>\n');
	Win.document.write('</body>\n');
	Win.document.write('</html>\n');
	Win.document.close();
	Win.focus();
}



// MHA comment - ToDo - nepouzivane skripty = Next CORR. / DEL

function popImage( imageURL,imageTitle ){
	var AutoClose = true;
	var PositionX = 10;
	var PositionY = 10;
	var defaultWidth  = 640;
	var defaultHeight = 480;
	var imgWin = window.open('','photoDetail','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 100, oH + 100 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 100 ) - myW ), oH = oH + ( (oH + 100 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera && screen.width>800 ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;">'))+
		'<img src="'+imageURL+'" alt="Otevírám obrázek ..." title="" onload="resizeWinTo();" onclick="window.close();">'+
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}

// script for McD07 / Produkty / Kvalita
function newObr(src,winName,w,h,prop,lp,tp) {
	winLeft = (!lp)? (screen.width - w) / 2 : lp;
	winTop = (!tp)? ((screen.height - h) / 2) : tp;
	winProp = (!prop)? 'menubar=no,resizable=no,scrollbars=0,status=no,toolbar=no,locationbar=no,directories=no' : prop;
	winProp += ',width='+w+',height='+h+',left='+winLeft+',top='+winTop;
	Win = window.open(src,winName,winProp);
	Win.focus();
}

function novy_obrazek(imgsrc, w, h, imgname) {
	newObr('','fotos', w, h);
	Win.document.open();
	Win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n');
	Win.document.write('<html>\n');
	Win.document.write('<head>\n');
	Win.document.write('	<title>'+imgname+'</title>\n');
	Win.document.write('	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">\n');
	Win.document.write('	<style type="text/css">body {margin: 0; color: #000;}</style>\n');
	Win.document.write('</head>\n');
	Win.document.write('<body>\n');
	Win.document.write('<img src="'+imgsrc+'" width="'+w+'" height="'+h+'" border="0" title="[kliknutím zavřít]" alt="[kliknutím zavřít]" onclick="window.close();">\n');
	Win.document.write('</body>\n');
	Win.document.write('</html>\n');
	Win.document.close();
	Win.focus();
}