/* Start Directions for Hidden Password 1.2 script


End Directions for Hidden Password script */ 

//Script begins

function AccessGranted() 
{
 document.write('<bgsound src="AccessGranted.wav" loop=0>')
 // You can replace AccessGranted.wav audio file with your own

 document.write('<center><h1>Password OK!</h1></center>')
 
 if (confirm("Enter Members area?"))
     {
      window.location="http://www.blackheathsquash.fsnet.co.uk/members/tel_num.html" 
      // Replace this URL with your own
     }
 else document.location="javascript: history.go(-1)" 

}

function IntruderAlert()
{
	/* remmed out the next 3 lines */
 /*document.write('<bgsound src="IntruderAlert.wav" loop=0>')*/
 /*document.write('<center><h1>Intruder Alert!</h1></center>')*/

 /*alert("Intruder Alert!")*/
 document.location="javascript: history.go(-1)"
}

function checkPassword()
{
 var turn
 var yourPassword = "BSRC1928" 

 for(turn=0;turn<3;++turn)
 {
  switch(turn)
  {
   case 0:
     password=prompt('Enter Your password:',"");
     if (password == yourPassword) AccessGranted()
     else alert("Password incorrect - this was your first attempt.")     
     break
    
   case 1:
     password=prompt('Enter Your password:',"");
     if (password == yourPassword) AccessGranted()
     else alert("Password incorrect - this was your second attempt.")     
     break

   case 2:
     password=prompt('Enter Your password:',"");
     if (password == yourPassword) AccessGranted()
     else alert("Password incorrect - Sorry you cannot enter the members area!")     
     IntruderAlert()
  }
 if (password == yourPassword) break;
 }
}

document.write('<form><input type=button value="Login Here" onClick="checkPassword()">')
//Script ends