// JavaScript Validation for Contact Form
//Check the enquiry form is filled in correctly
function CheckForm () { 

	//Initialise variables
	var errorMsg = "";

	//Check for a Name
	if (document.frmContact.Name.value == ""){
		errorMsg += "\n\tName \t- Enter your  Name";	
	}
	//Check for Url
	//if (document.frmContact.Phone.value == ""){
		//errorMsg += "\n\tPhone\t\t- Enter your City";	
	//}
	
	
	//Check for an e-mail address and that it is valid
	if ((document.frmContact.Email.value == "") || (document.frmContact.Email.value.length > 0 && (document.frmContact.Email.value.indexOf("@",0) == - 1 || document.frmContact.Email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter your valid e-mail address";
	}
	//Check for a Comments
	if (document.frmContact.Comments.value == ""){
		errorMsg += "\n\tComments \t- Enter Comments";	
	}

		
	//If there is a problem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}