/* ID-Verify Contact Form script */

document.getElementById("BtnSubmitContact").onclick = checkContact;

function checkContact()
{
	var isValid = true;
	var f = document.forms[0];
	var errors = "Please enter your information in the following required fields: \n";

	if(f.txtName.value.length == 0) {
		errors += "\n\t -  Please enter your Name.";
		isValid = false;	
	}
	if(f.txtPhone.value.length == 0) {
		errors += "\n\t -  Please enter a Contact Phone Number.";
		isValid = false;	
	}
	/*if(f.txtEmail.value.length == 0) {
		// -- Email not currently required
		//errors += "\n\t *  A Contact Email Address is required.";
		//isValid = false;
	} else {
		// Check for Properly Formatted Email Addresses
		if (!(isValidEmail(f.txtEmail.value))) {
			errors += "\n\t * Please enter a properly formatted Email address.";
			isValid = false;
		}
	}*/
	if(f.txtComments.value.length == 0) {
		errors += "\n\t -  Please enter your message.";
		isValid = false;	
	}
	if(!isValid) {
		alert(errors);
		return false;
	} else {
		return true;
		document.forms[0].submit();
	}
}

// Check for valid Email Address
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
