// JavaScript Document 
//Check the enquiry form is filled in correctly

function checkform () { 

	//Initialise variables
	var errorMsg = "";

	//Check for a name
	if (document.frmenquiry.txtname.value == ""){
		errorMsg += "\n\tName \t\t- Enter your Name";	
	}
	 	
	//Check for an enquiry
	if (document.frmenquiry.icomments.value == "") { 
 		errorMsg += "\n\tComments \t- Enter your comments";
	}
		
	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your comments have 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;
}

