function validate(target, section)
{
 if (getCookie('validate' + section) == null)
 {
  	var inpt = prompt('Please enter the password to view this page.', '');
		var pw = inpt.toLowerCase();

		var passcode = 1;
		for(i = 0; i < inpt.length; i++) 
				passcode *= inpt.charCodeAt(i);
				
		switch (section)
		{
		 case "students":
		 	  if (passcode == "76215114690303600000")
				{
		 		    var expdate = new Date();
			 			expdate.setTime (expdate.getTime() + (1 * 24 * 60 * 60 * 1000)); // valid for one day	
			 			setCookie ("validatestudents", "yes", expdate);
		 	 			location.href = target;
				}
				else
						alert ("Sorry, that password is not valid.");
		 		break;				
		 case "comp":
		 		if (passcode == "72095378761098000000")
  			{
		 		    var expdate = new Date();
			 			expdate.setTime (expdate.getTime() + (1 * 24 * 60 * 60 * 1000)); // valid for one day	
			 			setCookie ("validatecomp", "yes", expdate);
		 	 			location.href = target;
				}
				else
						alert ("Sorry, that password is not valid.");				
		 		break;
		 case "recital":
		 		if (passcode == "76215114690303600000")
  			{
		 		    var expdate = new Date();
			 			expdate.setTime (expdate.getTime() + (1 * 24 * 60 * 60 * 1000)); // valid for one day	
			 			setCookie ("validaterecital", "yes", expdate);
		 	 			location.href = target;
				}
				else
						alert ("Sorry, that password is not valid.");				
		 		break;
		 default:
				alert ("Section not found.");
		 		break;
		}
 }
 else
 		 location.replace(target);
}


