//funkcja javascript na potrzeby promocji świątecznej

if (typeof isVisible == 'undefined') var isVisible = '';

function show_holidays_promotion_left (giftId,lang,sessionId) {

	if (isVisible == '') {
		var body=document.getElementsByTagName("body");
		var td=document.getElementById("td_holidays_promotion_left");
		var div=document.getElementById("holidays_promotion_left");
		
		if (td && div) {
			var tempVar=td;
			var xt=tempVar.offsetLeft;
			var yt=tempVar.offsetTop;

			while(tempVar.offsetParent!=body[0])
			{
				tempVar=tempVar.offsetParent;
				xt=xt+tempVar.offsetLeft;
				yt=yt+tempVar.offsetTop;
			}

			divPosX=xt;
			divPosY=yt;

			div.style.width = "600px";
			div.style.height = "500px";



					div.style.top = (divPosY - 117)+"px";
					div.style.left = (divPosX - 15)+"px";


			div.style.display = 'block';
			div.innerHTML = '\
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\
						codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"\
						width="600" height="500" id="swf_holidays_promotion_left" align="middle">\
					<param name="allowScriptAccess" value="sameDomain" />\
					<param name="movie" value="/images/holidays_promotion/holidays_promotion_left.swf" />\
					<param name="quality" value="high" />\
					<param name="bgcolor" value="#ffffff" />\
					<param name="wmode" value="transparent" />\
					<param name="FlashVars" value="xmlConfig=/dispatch/gifts.dyn?element_id='+ giftId + '%26lang='+lang+'%26session_id='+sessionId+'"/>\
					<embed src="/images/holidays_promotion/holidays_promotion_left.swf" play="true" loop="false" quality="high" FlashVars="xmlConfig=/dispatch/gifts.dyn?element_id='+ giftId + '%26lang='+lang+'%26session_id='+sessionId+'" bgcolor="#ffffff" wmode="transparent" width="600" height="500"\
						name="holidays_promotion_left" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"\
						pluginspage="http://www.macromedia.com/go/getflashplayer" />\
				</object>';

			isVisible = 'left';
		}
	}

}

function show_holidays_promotion_right (giftId,lang,sessionId) {

	if (isVisible == '') {
		var body=document.getElementsByTagName("body");
		var td=document.getElementById("td_holidays_promotion_right");
		var div=document.getElementById("holidays_promotion_right");
		
		if (td && div) {
			var tempVar=td;
			var xt=tempVar.offsetLeft;
			var yt=tempVar.offsetTop;

			while(tempVar.offsetParent!=body[0])
			{
				tempVar=tempVar.offsetParent;
				xt=xt+tempVar.offsetLeft;
				yt=yt+tempVar.offsetTop;
			}

			divPosX=xt;
			divPosY=yt;

			div.style.width = "600px";
			div.style.height = "500px";

			div.style.top = (divPosY - 117)+"px";
			div.style.left = (divPosX - 412)+"px";

			div.style.display = 'block';
			div.innerHTML = '\
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\
						codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"\
						width="600" height="500" id="swf_holidays_promotion_right" align="middle">\
					<param name="allowScriptAccess" value="sameDomain" />\
					<param name="movie" value="/images/holidays_promotion/holidays_promotion_right.swf" />\
					<param name="quality" value="high" />\
					<param name="bgcolor" value="#ffffff" />\
					<param name="wmode" value="transparent" />\
					<param name="FlashVars" value="xmlConfig=/dispatch/gifts.dyn?element_id='+ giftId + '%26lang='+lang+'%26session_id='+sessionId+'"/>\
					<embed src="/images/holidays_promotion/holidays_promotion_right.swf" play="true" loop="false" quality="high" FlashVars="xmlConfig=/dispatch/gifts.dyn?element_id='+ giftId + '%26lang='+lang+'%26session_id='+sessionId+'" bgcolor="#ffffff" wmode="transparent" width="600" height="500"\
						name="holidays_promotion_right" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"\
						pluginspage="http://www.macromedia.com/go/getflashplayer" />\
				</object>';

			isVisible = 'right';
		}
	}

}



function hide_holidays_promotion() {

	var div=document.getElementById("holidays_promotion_"+isVisible);
	if (div) {
		div.style.display = 'none';
		div.innerHTML = '<!-- -->';

		isVisible = '';
	}
	
}

function show_consolation_prizes (url) {

	hide_holidays_promotion ();
	window.open(url, '', 'height=480,width=640, directories=no, sizeable=no, location=no, menubar=no, scrollbars=no, status=no, toolbar=no, left=0, top=0');
}

function show_contact_form (url) {

	hide_holidays_promotion ();
	window.open(url, '', 'height=700,width=720, directories=no, sizeable=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, left=0, top=0');
}

function WritePopupPL(){

	if(ns || ns6){
    	h = self.innerHeight;
	    w = self.innerWidth;
	} else {
	    h = document.body.clientHeight;
	    w = document.body.clientWidth;
	}
	if(h<550) h=550;
	if(h>600) h=600;
	if(w<900) left = (w/2) - 160;
	else left = (w/2) - 160
	
	  var isIE=(navigator.appName.indexOf("Microsoft")>=0)?1:0;
	      var Version=parseInt(navigator.appVersion);
	      var isIE5=(isIE && Version>=4)?1:0;

  
	    if (isIE5) {
	      document.write('<div id="toplayer"    style="position:absolute;  z-index:100;  left:' + left + '; top:490; width:100; height:100;">');
	      document.write('<table width="100" border=0 cellspacing=0 cellpadding=0   ><tr><td width="300">');
	      document.write('<div align=left bgcolor="#ffffff"  ><object id=topi name=topi classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=320 height=300>');
	      document.write('<param name=movie value="/images/holidays_promotion/holidays_promotion_banner_v2_PL.swf"/><param name=quality value=high><param name="wmode" value="transparent"/>');
		  document.write('<embed src="/images/holidays_promotion/holidays_promotion_banner_v2_PL.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width=320 height=300 wmode="transparent"></embed>');
	      document.write('</object></div></td><td width="*">&nbsp;</td></tr></table></div>');	     
    	}else{
	      document.write('<div id="toplayer"    style="position:absolute;  z-index:100;  left:' + left + '; top:490; width:100; height:100; ">');
	      document.write('<table width="100" border=0 cellspacing=0 cellpadding=0 ><tr><td width="300">'); 
	      document.write('<div align=left ><object id=topi name=topi classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=320 height=300>');
	      document.write('<param name=movie value="/images/holidays_promotion/holidays_promotion_banner_v2_PL.swf"/><param name=quality value=high><param name="wmode" value="transparent"/>');
		  document.write('<embed src="/images/holidays_promotion/holidays_promotion_banner_v2_PL.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width=320 height=300 wmode="transparent"></embed>');
	      document.write('</object></div></td><td width="*">&nbsp;</td></tr></table></div>');	     
	    }

}

function WritePopupEN(){

	if(ns || ns6){
    	h = self.innerHeight;
	    w = self.innerWidth;
	} else {
	    h = document.body.clientHeight;
	    w = document.body.clientWidth;
	}
	if(h<550) h=550;
	if(h>600) h=600;
	if(w<900) left = (w/2) - 160;
	else left = (w/2) - 160
	
	  var isIE=(navigator.appName.indexOf("Microsoft")>=0)?1:0;
	      var Version=parseInt(navigator.appVersion);
	      var isIE5=(isIE && Version>=4)?1:0;

  
		if (isIE5) {
	      document.write('<div id="toplayer"    style="position:absolute;  z-index:100;  left:' + left + '; top:490; width:100; height:100;">');
	      document.write('<table width="100" border=0 cellspacing=0 cellpadding=0   ><tr><td width="300">');
	      document.write('<div align=left bgcolor="#ffffff"  ><object id=topi name=topi classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=320 height=300>');
	      document.write('<param name=movie value="/images/holidays_promotion/holidays_promotion_banner_v2_EN.swf"/><param name=quality value=high><param name="wmode" value="transparent"/>');
		  document.write('<embed src="/images/holidays_promotion/holidays_promotion_banner_v2_EN.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width=320 height=300 wmode="transparent"></embed>');
	      document.write('</object></div></td><td width="*">&nbsp;</td></tr></table></div>');	     
    	}else{
	      document.write('<div id="toplayer"    style="position:absolute;  z-index:100;  left:' + left + '; top:490; width:100; height:100; ">');
	      document.write('<table width="100" border=0 cellspacing=0 cellpadding=0 ><tr><td width="300">'); 
	      document.write('<div align=left ><object id=topi name=topi classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=320 height=300>');
	      document.write('<param name=movie value="/images/holidays_promotion/holidays_promotion_banner_v2_EN.swf"/><param name=quality value=high><param name="wmode" value="transparent"/>');
		  document.write('<embed src="/images/holidays_promotion/holidays_promotion_banner_v2_EN.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width=320 height=300 wmode="transparent"></embed>');
	      document.write('</object></div></td><td width="*">&nbsp;</td></tr></table></div>');	     
	    }

}

function flashPlayerPromoEN(){
	var cookie = getCookie('flashPlayerBMPromo');
	if(cookie!=1){
		setCookie('flashPlayerBMPromo',1,60*24);
		WritePopupEN();
	}
}

function flashPlayerPromoPL(){
	var cookie = getCookie('flashPlayerBMPromo');
	if(cookie!=1){
		setCookie('flashPlayerBMPromo',1,60*24);
		WritePopupPL();
	}
}