
//Script begins

function AccessGranted() 
{
 
 if (confirm("Wollen Sie den ab 18 Jahre Bereich betreten?"))
     {
      document.location="intern/intern.html" 
     }
 else document.location="javascript: history.go(-1)" 

}

function IntruderAlert()
{
 
 alert("Zugriff verweigert!")
 document.location="javascript: history.go(-1)"
}

function checkPassword()
{
 var turn
 var yourPassword = "chapa3" 

 for(turn=0;turn<2;++turn)
 {
  switch(turn)
  {
   case 0:
     password=prompt('Geben Sie das Kennwort ein!',"");
     if (password == yourPassword) AccessGranted()
     else alert("Falsches Passwort!")     
     break

   case 1:
     password=prompt('Geben Sie das Kennwort ein!',"");
     if (password == yourPassword) AccessGranted()
     else alert("Falsches Passwort!")     
     IntruderAlert()
  }
 if (password == yourPassword) break;
 }
}

document.write('<center><input type=button value="Login" onClick="checkPassword()"></center>')
//Script ends
