
function validateForm(formObject){
	try {
		if (isBlank(formObject.FirstName)) {
			alert("Please enter your first name.");
			return false;
		}
		if (isBlank(formObject.LastName)) {
			alert("Please enter your last name.");
			return false;
		}
		if (isBlank(formObject.CompanyName)) {
			alert("Please enter your company's name.");
			return false;
		}
		if (!validateEmail(formObject.send_from.value)) {
			alert("Please enter a valid email address.");
			return false;
		}
		if (isBlank(formObject.Phone)) {
			alert("Please enter your telephone number.");
			return false;
		}
		if (isBlank(formObject.AMTime) && isBlank(formObject.PMTime)) {
			alert("Please enter the best time to contact you.");
			return false;
		}
		if (isBlank(formObject.InquiryType)) {
			// Do something;
				alert("Please select the type of project or enter it in the Other field.");
				return false;
		}
		return true;
	}
	catch(err) {
	   txt="JS:There was an error on this page.\n\n";
	   txt+="Error description: " + err.description + "\n\n";
	   txt+="Click OK to continue.\n\n";
	   alert(txt);
	   return false;
	}
}

function isBlank(checkField) {
	if (checkField.value.length == 0) {
		return true;
	}
	else {
		return false;
	}
}

function validateEmail( strValue) {
/************************************************
DESCRIPTION: Validates that a string contains a
  valid email pattern.

 PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false.

REMARKS: Accounts for email with country appended
  does not validate that email contains valid URL
  type (.com, .gov, etc.) or valid country suffix.
*************************************************/
var objRegExp  =
 /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

  //check for valid email
  return objRegExp.test(strValue);
}
