// JavaScript Document
// check form filled in properly
	function checkForm () {
		var errorMsg = "The following errors have occurred:- \n ";
		var returnCase = true;
		var regExpEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var regExpPhone = /^\+?(\d+\s?\d+)+$/;

		//check a name has been entered
		if (document.enquiryForm.name.value.length<2) {
			errorMsg += "no name has been entered \n ";
			returnCase = false;
			document.enquiryForm.name.focus();
		}
		
		//check for valid email
		if (!regExpEmail.test(document.enquiryForm.email.value)) {
			errorMsg +="an incorrect e-mail address has been entered \n ";
			if (returnCase == true) {
				document.enquiryForm.email.focus();
			}
			returnCase = false;
		}
		
		//check that something has been entered in the Address
		if (document.enquiryForm.address.value.length<10) {
			errorMsg += "please enter a bit more information in the address field";
			if (returnCase == true) {
				document.enquiryForm.address.focus();
			}
			returnCase = false;
		}
		//check that something has been entered in the Postcode
		if (document.enquiryForm.postcode.value.length<5) {
			errorMsg += "please enter a bit more information in the postcode field";
			if (returnCase == true) {
				document.enquiryForm.postcode.focus();
			}
			returnCase = false;
		}
		//check that something has been entered in the Enquiry Field
		if (document.enquiryForm.enquiry.value.length<10) {
			errorMsg += "please enter a bit more information in the enquiry field";
			if (returnCase == true) {
				document.enquiryForm.enquiry.focus();
			}
			returnCase = false;
		}
		//display error message
		if (returnCase == false) {
			alert("errorMsg = " + errorMsg);
		}
						
		return returnCase;
	}
