function switchToSmallSwf(){
 $('#flashPageFlip').css('top', '0');
 $('#flashPageFlipBig').css('top', '-1000px');
 }
$(document).ready(function() {

	//getCookie("hipp_popup");
$('#flashPageFlipBig').css('top', '-1000px');
$('#flashPageFlipBig').css('z-index', '1000');
                $('#flashPageFlip').flash({
                    swf: location.href+'/fileadmin/template/img/pageFlipSmall.swf',
                    height: 120,
                    width: 120,
                    params: {
                        play: true,
                        wmode: "transparent"
                    },
                    flashvars: { link: 'http://mleko.hipp.pl' }
                });

                $('#flashPageFlipBig').flash({
                    swf:location.href+'/fileadmin/template/img/pageFlipBig.swf',
                    height: 452,
                    width: 452,
                    params: {
                        play: true,
                        wmode: "transparent"
                    },
                    flashvars: { link: 'http://mleko.hipp.pl' }
                });


                $('#flashPageFlip').hover(function () {
                    $(this).css('top', '-1000px');
                    $('#flashPageFlipBig').css('top', '0');
                    return false;
                }); // flip z prawej strony
	$('#contestPhotos').hide();

	$('#rollDown').click(function() {

		$('#contestPhotos').toggle(1000);
		return false;

	});

	$('a#closeTesco').click(function(){

		$('#tesco').fadeOut(1000, function(){

			$(this).hide();
			$(this).css('display', 'none');

		});


		return false;

	});



	var flag = 1;

	setInterval(function(){

		if (flag == 0){
			/*
			$('#bottom_box_1 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/box_konkurs.jpg');
				$(this).parent().attr('href', '/?id=14');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_1 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html('<b>Konkursy!</b><br/>Zobacz nasze konkursy...<a class="link" href="?id=14">dalej</a>');
				$(this).fadeIn(1000);
			});


			$('#bottom_box_1 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/obiadki/baner.png');
				$(this).parent().attr('href', 'http://kraina.hipp.pl');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_1 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html("Załóż drzewko w krainie HiPP!  <a class=\"link\" href=\"http://kraina.hipp.pl/\">dalej</a>");
				$(this).fadeIn(1000);
			});


			$('#bottom_box_1 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/SG-wykres.gif');
				$(this).parent().attr('href', '/?id=410');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_1 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html("Sprawdź, jak prawidłowo rozszerzać dietę niemowlęcia!  <a class=\"link\" href=\"/?id=410">dalej</a>");
				$(this).fadeIn(1000);
			});




			$('#bottom_box_3 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/zawiera_omega3.jpg');
				$(this).parent().attr('href', '/?id=519');
				$(this).fadeIn(1000);
			});
			$('#bottom_box_3 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html('Konkurs zakończony. Sprawdź czy wygrałeś!<br/><a class="link" href="/?id=519">dalej</a>');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_2 .box_content_2 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/hipp_sklep.jpg');
				$(this).fadeIn(1000);
			});

			*/
			flag = 1;
		}
		else if (flag == 1){

			/*
			$('#bottom_box_1 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/krhipp.gif');
				$(this).parent().attr('href', 'http://www.kraina.hipp.pl/');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_1 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html('Załóż drzewko w krainie HiPP! <a class="link" href="http://www.kraina.hipp.pl/">dalej</a>');
				$(this).fadeIn(1000);
			});


			$('#bottom_box_1 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/dzien_dziecka/wakacje_z_hipp.jpg');
				$(this).attr('onClick', ' ');
				$(this).attr('onclick', ' ');
				$(this).parent().attr('href', 'http://hipp.pl/index.php?id=519');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_1 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html('Spróbuj swoich sił i weź udział w konkursie!!<br /><a class="link" href="http://hipp.pl/index.php?id=519">dalej</a>');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_3 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/promocje.jpg');
				$(this).parent().attr('href', '/?id=412');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_3 p').fadeOut(1000, function(){
				$(this).hide();
				$(this).html('<div style="background: url(/fileadmin/template/img/home/button_mleko.jpg) 0 0px; padding-left: 15px;  color:white;height:16px;padding-top:0px "><b><a style="color: white; text-decoration: none;" href="http://hipp.pl/?id=412">Promocje na mleko</a></b></div>Sprawdź aktualne promocje w sklepach!<br/><a class="link" href="/?id=412">dalej</a>');
				$(this).fadeIn(1000);
			});

			$('#bottom_box_2 .box_content_2 img').fadeOut(1000, function(){
				$(this).hide();
				$(this).attr('src', '/fileadmin/template/img/home/hipp_przesylka_gratis.jpg');
				$(this).fadeIn(1000);
			});

			*/

			flag = 0;
		}

	}, 5000);

	$('a[rel=lightbox]').lightBox();

	popup();

});

function blockContest()
{
	$('#contestNotice').fadeIn();
	return false;
}

function popup()
{
	$('#bannerImg5').click();
	return false;
}

function showToplayer(page){

	$('#bannerImg'+page).click();

	//tb_show(null, '/fileadmin/template/img/home/bannerImg/'+page+'.jpg', false);

//	return false;
}

function setCookie(c_name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}



function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name);
        if (c_start!=-1)
        {
           c_start=c_start + c_name.length+1;
           c_end=document.cookie.indexOf(";",c_start);
           if (c_end==-1) c_end=document.cookie.length;
           c_value = unescape(document.cookie.substring(c_start,c_end));
           if(c_value < 2)
           {
              setCookie(c_name, parseInt(c_value) + 1 , 1000);
              window.open('index.php?id=504', 'HippPopup', 'scrollbars=yes,width=520,height=605'); return false;
           }
        }
        else
        {
            setCookie(c_name, 1 , 1000);
            window.open('index.php?id=504', 'HippPopup', 'scrollbars=yes,width=520,height=605'); return false;
        }
   }
   else
   {
        setCookie(c_name, 1 , 1000);
        window.open('index.php?id=504', 'HippPopup', 'scrollbars=yes,width=520,height=605'); return false;
   }
   return "";
}
/* jquery.swfobject.license.txt */
(function(D){var F=document,H="extend",C=function(){},E="join",B="object",G='style="vertical-align:bottom;',A="";D.flashPlayerVersion=(function(){var K,I,N,M,P=false,O="ShockwaveFlash.ShockwaveFlash";if(!(K=navigator.plugins["Shockwave Flash"])){try{I=new ActiveXObject(O+".7")}catch(N){try{I=new ActiveXObject(O+".6");K=[6,0,21];I.AllowScriptAccess="always"}catch(M){if(K&&K[0]==6){P=true}}if(!P){try{I=new ActiveXObject(O)}catch(L){K="X 0,0,0"}}}if(!P&&I){try{K=I.GetVariable("$version")}catch(J){}}}else{K=K.description}K=K.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[K[1]*1,K[3]*1,K[5]*1]}());D.flashExpressInstaller="expressInstall.swf";D.hasFlashPlayer=(D.flashPlayerVersion[0]!=0);D.hasFlashPlayerVersion=function(J){var I=D.flashPlayerVersion;J=(/string|number/.test(typeof J))?J.toString().split("."):J;J=[J.major||J[0]||I[0],J.minor||J[1]||I[1],J.release||J[2]||I[2]];return(D.hasFlashPlayer&&(J[0]<I[0]||(J[0]==I[0]&&(J[1]<I[1]||(J[1]==I[1]&&J[2]<=I[2])))))};D.flash=function(R){if(!D.hasFlashPlayer){return false}var J=R.swf||A,P=R.params||{},L=F.createElement("body"),I,Q,M,K,O,N;R.height=R.height||180;R.width=R.width||320;if(R.hasVersion&&!D.hasFlashPlayerVersion(R.hasVersion)){D[H](R,{id:"SWFObjectExprInst",height:Math.max(R.height,137),width:Math.max(R.width,214)});J=R.expressInstaller||D.flashExpressInstaller;P={flashvars:{MMredirectURL:location.href,MMplayerType:(D.browser.msie&&D.browser.win)?"ActiveX":"PlugIn",MMdoctitle:F.title.slice(0,47)+" - Flash Player Installation"}}}if(typeof P==B){if(R.flashvars){P.flashvars=R.flashvars}if(R.wmode){P.wmode=R.wmode}}for(O in (N=["expressInstall","flashvars","hasVersion","params","swf","wmode"])){delete R[N[O]]}I=[];for(O in R){if(typeof R[O]==B){Q=[];for(N in R[O]){Q.push(N.replace(/([A-Z])/,"-$1").toLowerCase()+":"+R[O][N]+";")}R[O]=Q[E](A)}I.push(O+'="'+R[O]+'"')}R=I[E](" ");if(typeof P==B){I=[];for(O in P){if(typeof P[O]==B){Q=[];for(N in P[O]){Q.push([N,"=",encodeURIComponent(P[O][N])][E](A))}P[O]=Q[E]("&amp;")}I.push(['<PARAM NAME="',O,'" VALUE="',P[O],'">'][E](A))}P=I[E](A)}if(!(/style=/.test(R))){R+=" "+G+'"'}if(!(/style=(.*?)vertical-align/.test(R))){R=R.replace(/style="/,G)}if(D.browser.msie){R+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';P='<PARAM NAME="movie" VALUE="'+J+'">'+P}else{R+=' type="application/x-shockwave-flash" data="'+J+'"'}L.innerHTML=["<OBJECT ",R,">",P,"</OBJECT>"][E](A);return D(L.firstChild)};D.fn.flash=function(K){if(!D.hasFlashPlayer){return this}var L=0,I,J;while((J=this.eq(L++))[0]){I=D[H]({beforeEach:C,afterEach:C},K);I.beforeEach.apply(J[0],[K]);J.html(D.flash(I));if(F.getElementById("SWFObjectExprInst")){L=this.length}I.afterEach.apply(J[0],[K])}return this}}(jQuery));

