// JavaScript Document
function Login(){
	var status="available";
	var username=document.login.username.value;
	username=username.toLowerCase();
	if (username=="17/04/2008") {status="booked";}	
	if (username=="03/05/2008") {status="booked";}
	if (username=="24/05/2008") {status="booked";}
	if (username=="07/06/2008") {status="booked";}
	if (username=="28/06/2008") {status="booked";}
	if (username=="05/07/2008") {status="booked";}
	if (username=="19/07/2008") {status="booked";}
	if (username=="20/07/2008") {status="booked";}
	if (username=="26/07/2008") {status="booked";}
	if (username=="02/08/2008") {status="booked";}
	if (username=="08/08/2008") {status="booked";}
	if (username=="09/08/2008") {status="booked";}
	if (username=="23/08/2008") {status="booked";}
	if (username=="24/08/2008") {status="booked";}
	if (username=="05/09/2008") {status="booked";}	
	if (username=="20/09/2008") {status="booked";}
	if (username=="29/09/2008") {status="booked";}
	if (username=="01/10/2008") {status="booked";}
	if (username=="21/11/2008") {status="booked";}
	if (username=="22/11/2008") {status="booked";}
	if (username=="06/06/2009") {status="booked";}
	if (username=="") {alert('Please use the calendar to select a valid date.'); status="invalid";}
	if (username==" ") {alert('Please use the calendar to select a valid date.'); status="invalid";}
	if (status=="invalid") { window.location="availability.html"; }	
	if (status=="available") { window.location="availability-free.html"; }
	if (status=="booked") { window.location="availability-booked.html"; }
}

function validateDate(fld) {
    var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
    var errorMessage = 'Please enter valid date using the calendar or type it as dd\/mm\/yyyy.';
    if ((fld.value.match(RegExPattern)) && (fld.value!='')) {
        staus="available"; 
    } else {
        staus="invalid";
		window.location="availability.html";
    } 
}