function validateFormOnSubmit(theForm) {
var reason = "";
reason += check(theForm.enquiry);
reason += checkemail(theForm.email);
reason += check(theForm.phone);
reason += check(theForm.name);




if (reason != "") {
    alert("Please fill in all of the fields and try again!");
    return false;
  }

  return true;
}
function checkemail(email) {
	var error = "";
	apos=email.value.indexOf("@")
	dotpos=email.value.lastIndexOf(".")

if (email.value == "" || apos<1 || dotpos-apos<2)
{
		 email.focus();
 		error = "error"
} else {
    	
}
    return error;  
}

function check(field) {
    var error = "";
 
    if (field.value.length == 0) {
	    field.focus();
       error = "error"
    } else {
        
    }
    return error;  
}
