function getCookie(name){
   var i=0  //Suchposition im Cookie
   var suche = name+"="
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length)
         ende = (ende>-1) ? ende : document.cookie.length
         var cook = document.cookie.substring(i+suche.length, ende)
         return unescape(cook)
      }
      i++
   }
   return null
}

function setCookie(name, wert, domain, expires, path, secure){
   var cook = name + "=" + unescape(wert)

   cook += (domain) ? "; domain="+ domain : ""
   cook += (expires) ? "; expires="+expires : ""
   cook += (path) ? "; path="+path : ""
   cook += (secure) ? "; secure" : ""
   document.cookie = cook
}

function popup1( popup_sid, url, xdim, ydim, message ) {
   var verfall = new Date();

   verfall.setTime( verfall.getTime() + (2 * 3600 * 1000) );

   test_popup = getCookie ( "popup_sid" );
   test_alert = getCookie ( "alert_sid" );

   if( test_popup != popup_sid ) { 
      myWin = window.open( url, 'Newsletter', 'width='+xdim+', height='+ydim+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
      window.focus();
      if (!myWin) {
         if ( test_alert != "1" ) {
            alert( message );
            setCookie ( "alert_sid", "1", null, verfall );        
         }
      } else {
         setCookie ( "popup_sid", popup_sid, null, verfall );
      } 
   }
}
function popUp(url,winname,mwidth,mheight,popunder)  {
	var fenster = window.open(url,winname,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=' + mwidth + ',height=' + mheight);
	if ( popunder ) {
	window.focus();
        } else {
	fenster.focus();
}
if (!fenster) {
    alert("Sie verwenden einen pop-Up-Blocker \n Bitte deaktivieren Sie diesen, um die kostenlose Chance auf eine Traumreise zu haben!");
  }
}

function SetSelected(sel_objekt,wert) {
   var anzahl = sel_objekt.length;

   if ( wert != "" ) {
     for ( i = 0 ; i < anzahl ; i++ ) {
        sel_objekt.options[i].selected = ( sel_objekt.options[i].value == wert );
        if ( sel_objekt.options[i].value == wert ) break;
     }   
   }
}

function neuesFenster(adresse){
  if (navigator.appName == "Netscape") { 
    Fenster=window.open(adresse, "neues" ,"resizable=no,toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,width=700,height=400"); Fenster.focus(Fenster); 
   } 
else { 
   Fenster=window.open(adresse, "neues" ,"resizable=no,toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,width=700,height=400"); 
}
if (!Fenster) {
    alert("Sie verwenden einen pop-Up-Blocker \n Bitte deaktivieren Sie diesen, um die kostenlose Chance auf eine Traumreise zu haben!");
  }
}
