function catSwitch(id){
   if(id != catActive){
      document.getElementById('sub'+id).style.display = 'block';
      if(catActive != 0){
      document.getElementById('sub'+catActive).style.display = 'none';}      
      catActive = id;
      }
   }

function goAdmin(){
   window.open('admin/login.php','','width=240,height=130,status=yes');
   }

function checkPlz(){
   if(document.form.plz.value == ""){
   alert("Bitte geben Sie eine PLZ an");
   document.form.plz.focus();
   return false;
   }
   hidden.location.href='checkPlz.php?plz='+document.form.plz.value;
   }

function checkUsrDis(){
   hidden.location.href='inc/disney/checkUsrDis.php?account='+document.form.account.value;
   }

function checkUsrPress(){
   hidden.location.href='inc/press/checkUsrPress.php?account='+document.form.account.value;
   }

function checkPlzMain(){
   if(document.form.plz.value == ""){
   alert("Bitte geben Sie eine PLZ an");
   document.form.plz.focus();
   return false;
   }
   hidden.location.href='admin/checkPlz.php?plz='+document.form.plz.value;
   }


function delUserDisAdm(id){
    var agree=confirm("Moechten Sie den Account wirklich löschen?");
    if (agree)
          location.href= 'index.php?pagePos=260&id='+id;
    else
          {return false;}
    }

function delAboAdm(id){
    var agree=confirm("Moechten Sie den Abonenten wirklich löschen?");
    if (agree)
          location.href= 'index.php?pagePos=280&id='+id;
    else
          {return false;}
    }

function delUserPressAdm(id){
    var agree=confirm("Moechten Sie den Account wirklich löschen?");
    if (agree)
          location.href= 'index.php?pagePos=270&id='+id;
    else
          {return false;}
    }
    
function delUserDis(){
    var agree=confirm("Moechten Sie Ihren Account wirklich löschen?");
    if (agree)
          location.href= 'index.php?pagePos=89';
    else
          {return false;}
    }

function checkKid(){
   if(document.form.kind0.value == "" || document.form.kindb0.value == ""){
      alert("Bitte geben Sie Namen und Geburtsdatum an");
      return false;
      }

   date = document.form.kindb0.value;
   if(date != ""){
      if(date.charAt(2)!="." && date.charAt(5)!="."){
         alert("Bitte Datum im Format dd.mm.yyyy eintragen");
         document.form.kindb0.focus();
         return false;
         }
      }

   
   hidden.location.href='inc/disney/checkKids.php?kind0='+document.form.kind0.value+'&kindb0='+document.form.kindb0.value;;
   }
   
function verboten(s,verb)
{
  debug=false;
  for(i=0;i<verb.length;i++)
  {
      if(s.indexOf(verb.charAt(i)) != -1)
      {
              if(debug)
                  alert(verb.charAt(i)+"\nEs kommt ein verbotenes Zeichen vor");
              return false;
      }
  }
  return true;
}


function chkmail()
{
  var s=eval("document.form.email.value");
  if(s!="")
  {
      ok=true;
      l=s.length;
      if(l<9)
          ok=false;           //zu kurz!
      x=s.indexOf("@",2);     //ist ab der 3.Stelle irgendwo ein @ zu finden?
      if(!(x!=-1 && x<l-6 && ok))
          ok=false;           //und ist @ mindestens 6 Zeichen vor dem Ende?
      if((s.charAt(l-3)!="." && s.charAt(l-4)!="." && s.charAt(l-5)!=".") || ok==false)
          ok=false;           //ist das 4.- oder 3.letze Zeichen ein Punkt?
      if(s.indexOf("@",x+1)>-1 || ok==false)
          ok=false;           //kommt noch ein zweites @ vor?
      if(!verboten(s," \"<>|µ,;:#'*+^°!%&/$§()=?\~ß}{[]éèäöüÄÖÜêáàâ") || ok==false)
          ok=false;           //email enthält verbotene zeichen
      if(!ok)
      {
          alert("Bitte tragen Sie eine gültige E-Mail-Adresse ein");
          return false;
      }
  }
  else
  {
  alert("Bitte tragen Sie Ihre E-Mail-Adresse ein");
  return false;
  }
  return true;
}

function disForm(fLen){
   
   ok = "yes";
   
   name = document.form.name.value;
   vorname = document.form.vorname.value;
   street = document.form.street.value;
   plz = document.form.plz.value;
   ort = document.form.ort.value;
   
   if(document.form.account){
   account = document.form.account.value;}
   
   pwd = document.form.pwd.value;
   fon = document.form.fon.value;
   email = document.form.email.value;
   name = document.form.name.value;
   
   for(i=2;i<fLen;i++){
      
      //alert(document.form.elements[i].type+' - '+document.form.elements[i].name+' - '+document.form.elements[i].value);
      
      if(document.form.elements[i].type == "text" && document.form.elements[i].name != "fon"){
         if(document.form.elements[i].value == ""){
         ok = "no";}
      }
   }
   
   if(ok == "no"){
      alert("Bitte füllen Sie alle Felder mit einem * aus");
      return false;
      }

   if(document.form.account){  
      if(account.length <5){
         alert("Mindestens 5 Zeichen länge");
         document.form.account.focus();
         return false;
         }
      }

   if(pwd.length <5){
      alert("Mindestens 5 Zeichen länge");
      document.form.pwd.focus();
      return false;
      }

   if(!chkmail()){
   return false;
   }

   if(document.form.kind0.value != "" || document.kindb0.value != ""){
      alert("Bitte speichern Sie das eingetragene Kind vorerst ab");
      return false;
      }
   
   date = document.form.kindb0.value;
   if(date != ""){
      if(date.charAt(2)!="." && date.charAt(5)!="."){
         alert("Bitte Datum im Format dd.mm.yyyy eintragen");
         document.form.kindb0.focus();
         return false;
         }
      }

   document.form.action = 'index.php';
   document.form.target = '_top';
   document.form.submit();
}

function disLogin(){
   if(document.form.account.value == "" || document.form.pwd.value == ""){
      alert("Bitte füllen Sie die Felder aus");
      return false;
      }

   document.form.target='hidden';
   }

function chklpwd(){
   if(document.form.email.value==""){
      alert("Bitte tragen Sie Ihre E-Mail-Adresse ein");
      return false;
      }
   
   if(!chkmail()){
      return false;
      }
   
   document.form.target = 'hidden';
}


function pressForm(){
   
   var ok = "yes";
   
   medium = document.form.medium.value;
   redaktion = document.form.redaktion.value;
   anrede = document.form.anrede.value;
   name = document.form.name.value;
   vorname = document.form.vorname.value;
   street = document.form.street.value;
   plz = document.form.plz.value;
   
   if(document.form.account){
   account = document.form.account.value;}
   
   pwd = document.form.pwd.value;
   fon = document.form.fon.value;
   fax = document.form.fax.value;
   email = document.form.email.value;
   name = document.form.name.value;
   
   for(i=1;i<(document.form.elements.length-3);i++){
      if(document.form.elements[i].type == "text" && document.form.elements[i].name != "fax"){
         if(document.form.elements[i].value == ""){
         ok = "no";}
      }
   }
   
   if(ok == "no"){
      alert("Bitte füllen Sie alle Felder aus");
      return false;
      }

   if(document.form.account){  
      if(account.length <5){
         alert("Mindestens 5 Zeichen länge");
         document.form.account.focus();
         return false;
         }
      }

   if(pwd.length <5){
      alert("Mindestens 5 Zeichen länge");
      document.form.pwd.focus();
      return false;
      }

   if(!chkmail()){
   return false;
   }

   document.form.action = 'index.php';
   document.form.target = '_top';
   document.form.submit();
}

function pressLogin(){
   if(document.form.account.value == "" || document.form.pwd.value == ""){
      alert("Bitte füllen Sie die Felder aus");
      return false;
      }

   document.form.target='hidden';
   }

function conForm(){
   
   ok = "yes";
   
   name = document.form.name.value;
   vorname = document.form.vorname.value;
   email = document.form.email.value;
   frage = document.form.frage.value;
   
 
   if(name == "" || vorname == "" || email =="" || frage == ""){
      alert("Bitte füllen Sie die nötigen Felder aus");
      return false;
      }

   if(!chkmail()){
   return false;
   }
}

blink(0.7);

function blink(speed)
{
if (speed) {
if (document.all)
setInterval("blink()", speed*1000)
return;
}
var blink = document.all.tags("BLINK")
for (var i=0; i<blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
} 