
function validateForm(theForm)
 {
	 // Declare and initialise variables
	 var warningtxt = "";
	 
	 warningtxt = validateField(theForm.txtName, "Please Enter Your Name");
	 warningtxt += validateFields(theForm.txtEmail, theForm.txtPhone, "Please Enter Your Email Address or Phone Number");
	 
	 // Determine whether the form is valid
	 if (warningtxt == "") 
	 {
    	document.getElementById("formwarningcontainer").innerHTML = "";
		return true;
 	 }
	 else
	 {
		document.getElementById("formwarningcontainer").innerHTML = "<div id=\"formwarning\"><h3>Attention</h3><p>" + warningtxt + "</p></div>";
		scroll(0,0);
		return false;
	 }
 }
 
 function validateField(field, errortext)
 {
	 with (field)
	 {
		 if (field.value.length == 0)
		 {
			style.background = "#E06767";
			return errortext + "<br />";
		 }
 		 else
		 {
			style.background = "White";
		 	return "";
		 }
	 }
 }
 
 function validateFields(field1,field2, errortext)
 {
	 if (field1.value.length == 0 && field2.value.length == 0)
	 {
		 field1.style.background = "#E06767";
		 field2.style.background = "#E06767";
		 return errortext + "<br />";
	 } else {
		 field1.style.background = "White";
		 field2.style.background = "White";
		 return "";
	 }
 }