// Ziel-Datum 
  var jahr=2008, monat=5, tag=11, stunde=0, minute=0, sekunde=0;
  //var jahr=2008, monat=5, tag=3, stunde=17, minute=41, sekunde=10;
  var zielDatum=new Date(jahr,monat-1,tag,stunde,minute,sekunde);



function MM_reloadPage(init) {  //Updated by PVII. Reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



function MM_findObj(n, d) { // v4.01  
  var p,i,x;  if(!d) d=document;  
if((p=n.indexOf("?"))>0&&parent.frames.length) {  
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)  
x=d.forms[i][n];  
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)  
x=MM_findObj(n,d.layers[i].document);  
  if(!x && d.getElementById) x=d.getElementById(n); return x;  
}



function DrawPromo(){
var v1=arguments,v2=v1[0],v3=MM_findObj(v2),v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20=window,v21=navigator;if (v3){v4=parseInt(v1[1]);v5=parseInt(v1[2]);v6=parseInt(v1[3]);v7=(v1.length>4)?parseInt(v1[4]):0;v8=(v1.length>5)?parseInt(v1[5]):0;v9=10;v10=document.layers?v3:v3.style;if (v3.SL1!=null){clearTimeout(v3.SL1);}v11=isNaN(parseInt(v10.left))?v3.offsetLeft:parseInt(v10.left);v12=isNaN(parseInt(v10.top))?v3.offsetTop:parseInt(v10.top);if (v8!=0){if (v8==1){v4=v11-v4;v5=v12;}else if (v8==2){v4=v11+v4;v5=v12;}else if (v8==3){v5=v12-v5;v4=v11;}else {v5=v12+v5;v4=v11;}}v13=v4;v14=v5;if ((v11!=v4)||(v12!=v5)){if (v7>0){v9=v6;v15=v7;v16=v7,v17=Math.abs(v11-v4),v18=Math.abs(v12-v5);if (v17<v18){v16=(v17!=0)?((v18/v17)*v7):v7;}else {v15=(v18!=0)?((v17/v18)*v7):v7;}if (v15>=v17){v15=Math.min(Math.ceil(v15),v7);}if (v16>=v18){v16=Math.min(Math.ceil(v16),v7);}if ((v11<v4)&&(v11+v15<v4)){v4=v11+v15;}if ((v11>v4)&&(v11-v15>v4)){v4=v11-v15;}if ((v12<v5)&&(v12+v16<v5)){v5=v12+v16;}if ((v12>v5)&&(v12-v16>v5)){v5=v12-v16;}}else {v17=((v4-v11)/v6);v18=((v5-v12)/v6);v17=(v17>0)?Math.ceil(v17):Math.floor(v17);v4=v11+v17;v18=(v18>0)?Math.ceil(v18):Math.floor(v18);v5=v12+v18;}v19=((parseInt(v21.appVersion)>4||v21.userAgent.indexOf("MSIE")>-1)&&(!v20.opera))?"px":"";if (v17!=0){v10.left=v4+v19;}if (v18!=0){v10.top=v5+v19;}var v22="DrawPromo('"+v2+"',"+v13+","+v14+","+v6+","+v7+",0)";v3.SL1=setTimeout(v22,v9);}else {if (v20.onSlideEnd){onSlideEnd(v2);}}}
}



function loadPromo(layerview, loadfromshop) {

	startPromoDatum=new Date(); // Aktuelles Datum

	// Countdown berechnen und Promo anzeigen, bis Ziel-Datum erreicht ist
	if(startPromoDatum>zielDatum)  {
	
	   if (loadfromshop) { 
	      hidePromoShop(); 
	      document.getElementById("PromoLayer").style.display = 'none';
	      document.getElementById("PromoLayerShopOFF").style.display = 'none';	      
	   } else { 
	      hidePromo(); 
	      document.getElementById("PromoLayer").style.display = 'none';
	      document.getElementById("PromoLayerOFF").style.display = 'none';
	   }
	
	} else {

		var layeralreadyshown = Get_Cookie("smukepromo");
		
		if(!layeralreadyshown) {
		   Set_Cookie( 'smukepromo', '1', 1, '/', '', '' )
		   var layeralreadyshown = Get_Cookie("smukepromo");
		}
		

		//Debug
		//alert(layeralreadyshown);

		if(layeralreadyshown==2 || !layeralreadyshown) {

		   if (loadfromshop) { hidePromoShop(); } else { hidePromo(); }

		} else {

			if (layerview==1 || layeralreadyshown!=1) {
			   // Promo layer einblenden
			   if (loadfromshop) { showPromoShop(); } else { showPromo(); }
			}

			// Cookie setzten, damit promo layer nur einmal pro Tag/Besuch angezeigt wird
			Set_Cookie( 'smukepromo', '2', 1, '/', '', '' )
		}
	}
   
}



// Promo einblenden für Webseite
function showPromo() {

   countdown();
   DrawPromo('PromoLayer',0,-53,10,0,0);
   DrawPromo('PromoLayerOFF',0,-130,10,0,0)

}

// Promo ausblenden für Webseite
function hidePromo() {

   countdown('1');
   DrawPromo('PromoLayerOFF',0,385,10,0,0);
   DrawPromo('PromoLayer',0,-550,10,0,0)

}



// Promo einblenden für Shop
function showPromoShop() {

   countdown();
   DrawPromo('PromoLayer',0,-53,10,0,0);
   //document.getElementById("PromoLayerShopOFF").style.display = 'none';

}

// Promo ausblenden für Shop
function hidePromoShop() {

   countdown('1');
   document.getElementById("PromoLayerShopOFF").style.display = 'block';
   DrawPromo('PromoLayer',0,-550,10,0,0)

}


// Countdown routine
function countdown(off) {

   startDatum=new Date(); // Aktuelles Datum

	// Countdown berechnen und anzeigen, bis Ziel-Datum erreicht ist
	if(startDatum<zielDatum)  {

	  var jahre=0, monate=0, tage=0, stunden=0, minuten=0, sekunden=0;

	  // Jahre
	  while(startDatum<zielDatum) {
	    jahre++;
	    startDatum.setFullYear(startDatum.getFullYear()+1);
	  }
	  startDatum.setFullYear(startDatum.getFullYear()-1);
	  jahre--;

	  // Monate
	  while(startDatum<zielDatum) {
	    monate++;
	    startDatum.setMonth(startDatum.getMonth()+1);
	  }
	  startDatum.setMonth(startDatum.getMonth()-1);
	  monate--;

	  // Tage
	  while(startDatum.getTime()+(24*60*60*1000)<zielDatum) {
	    tage++;
	    startDatum.setTime(startDatum.getTime()+(24*60*60*1000));
	  }

	  // Stunden
	  stunden=Math.floor((zielDatum-startDatum)/(60*60*1000));
	  startDatum.setTime(startDatum.getTime()+stunden*60*60*1000);

	  // Minuten
	  minuten=Math.floor((zielDatum-startDatum)/(60*1000));
	  startDatum.setTime(startDatum.getTime()+minuten*60*1000);

	  // Sekunden
	  sekunden=Math.floor((zielDatum-startDatum)/1000);


	  // Anzeige formatieren
	  //(jahre!=1)?jahre=jahre+" Jahre,  ":jahre=jahre+" Jahr,  ";
	  //(monate!=1)?monate=monate+" Monate,  ":monate=monate+" Monat,  ";
	  (tage!=1)?tage=tage+" "+text_days:tage=tage+" "+text_day;
	  //stunden = stunden + (tage*24);

		  if (off) {
		    (stunden!=1)?stunden=stunden+" "+text_stunden+", ":stunden=stunden+" "+text_stunde+", ";
		    (minuten!=1)?minuten=minuten+" "+text_minuten+" "+text_und+" ":minuten=minuten+" "+text_minute+" "+text_und+" ";
		    (sekunden!=1)?sekunden=sekunden+" "+text_sekunden:sekunden=sekunden+" "+text_sekunde;
		    document.getElementById("countdowninputOff").value=text_noch+" "+tage+", "+stunden+minuten+sekunden+" "+text_noch_end;   
		    setTimeout('countdown(1)',1000);
		  } else {
		    if(stunden<10) stunden="0"+stunden;
		    if(sekunden<10) sekunden="0"+sekunden;
		    if(minuten<10) minuten="0"+minuten;			  
		    document.getElementById("countdowninputdays").value=tage;
		    document.getElementById("countdowninput").value=stunden+":"+minuten+":"+sekunden;
		    setTimeout('countdown()',1000);
		  }



	} else { // Anderenfalls alles auf Null setzen
	    //"0 Jahre,  0 Monate,  0 Tage,  0 Stunden,  0 Minuten  und  00 Sekunden";
		  if (off) {
		     document.getElementById("countdowninputOff").value=text_aktion+" "+text_beendet;   
		  } else {
		     document.getElementById("countdowninput").value=text_beendet;
		     document.getElementById("countdowninputdays").value=text_aktion;
		  }

	} // END IF

} //END FUNCTION