//Check the enquiry form is filled in correctly
function CheckForm () { 

	//Initialise variables
	var errorMsg = "";

	//Check for a Your name
	if (document.inspireMe.yourName.value == ""){
		errorMsg += "\nEnter your Name";	
	}
	
	//Check for your e-mail address and that it is valid
	if ((document.inspireMe.yourEmail.value == "") || (document.inspireMe.yourEmail.value.length > 0 && (document.inspireMe.yourEmail.value.indexOf("@",0) == - 1 || document.inspireMe.yourEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nEnter your valid e-mail address";
	}
	
	//Check for a Friend's name
	if (document.inspireMe.friendName.value == ""){
		errorMsg += "\nEnter your Friend's Name";	
	}
	
	//Check for your e-mail address and that it is valid
	if ((document.inspireMe.friendEmail.value == "") || (document.inspireMe.friendEmail.value.length > 0 && (document.inspireMe.friendEmail.value.indexOf("@",0) == - 1 || document.inspireMe.friendEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nEnter your friend's valid e-mail address";
	}
				
	//If there is aproblem with the form then display an error
	if (errorMsg != ""){

		msg = "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}