// JavaScript Validation for Contact Form
//Check the enquiry form is filled in correctly
function CheckForm () { 

	//Initialise variables
	var errorMsg = "";

	//Check for an e-mail address and that it is valid
	if ((document.frmEnquiry.Email.value == "") || (document.frmEnquiry.Email.value.length > 0 && (document.frmEnquiry.Email.value.indexOf("@",0) == - 1 || document.frmEnquiry.Email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Address \t- Enter a valid e-mail address";
	}

	//Check for a password
	if (document.frmEnquiry.Password.value == ""){
		errorMsg += "\nPassword \t- Please enter a password";	
	}

	//Check for a region
//	if (document.frmEnquiry.Counties.value == ""){
//		errorMsg += "\nCounty \t\t- Please select an area you are interested in";	
//	}
	
	
	//Check for an event type
//	if (document.frmEnquiry.Events.value == "") {
//		errorMsg += "\nEvent type \t- Please select the events you are interested in";	
//	}
	
		
	//Check for a CAPTCHA
	//if (document.frmEnquiry.verification.value != "06571053") {
	//	errorMsg += "\n\tValidation \t- You did not type in the correct verification code";	
	//}
					
	//If there is a problem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your registration has not been submitted because the required information\n";
		msg += "has not been completed.\n\n";
		msg += "Please complete the information and re-submit your registration.\n";
		msg += "______________________________________________________________\n\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
