function checkContactForm() {	txtName = document.getElementById("txtName");	txtLastName = document.getElementById("txtLastName");	txtEmail = document.getElementById("txtEmail");	txtPhone = document.getElementById("txtPhone");	txtRegarding = document.getElementById("txtRegarding");	txtComments = document.getElementById("txtComments");	txtSecCode = document.getElementById("security-code");	hidSecCode = document.getElementById("hid-security-code");	if (validate_required(txtRegarding, "Please let us know what your message is regarding!") == false) {		return false;	}	if (txtName.value == txtName.title) {		alert("First Name must be filled out!");		txtName.focus();		return false;	}	if (validate_required(txtName, "First Name must be filled out!") == false) {		txtName.focus();		return false;	}	if (txtLastName.value == txtLastName.title) {		alert("Last Name must be filled out!");		txtLastName.focus();		return false;	}	if (validate_required(txtName, "Last Name must be filled out!") == false) {		txtLastName.focus();		return false;	}	if (txtEmail.value != txtEmail.title) {		if (echeck(txtEmail.value) == false) {			txtEmail.focus();			return false;		}	} else {		{			alert("Email must be filled out!");			txtEmail.focus();			return false;		}	}	if (txtPhone.value == txtPhone.title) {		alert("Phone must be filled out!");		txtPhone.focus();		return false;	}	if (validatePhoneNumber(txtPhone.value) == false) {		txtPhone.focus();		alert("Please enter a valid phone number");		return false;	}	if (txtComments.value == txtComments.title) {		alert("Comments must be filled out!");		txtComments.focus();		return false;	}	if (validate_required(txtComments, "Comments must be filled out!") == false) {		txtComments.focus();		return false;	}	if (txtSecCode.value == "") {		alert("Security Code must be filled out!");		txtSecCode.focus();		return false;	}	if (txtSecCode.value != hidSecCode.value) {		alert("Security Code does not match!");		txtSecCode.focus();		return false;	}	return true;}function checkPopupContactForm() {	txtName = jQuery("#contact-name");	txtEmail = jQuery("#contact-email");	txtPhone = jQuery("#contact-phone");	txtComments = jQuery("#contact-comments");	txtSecCode = jQuery("#contact-security");	hidSecCode = jQuery("#hid-contact-security");	if (txtName.val() == txtName.attr('title') && txtName.val().length > 0) {		alert("Name must be filled out!");		txtName.focus();		return false;	}	if (txtEmail.val() != txtEmail.attr('title')) {		if (!validateEmail(txtEmail.val())) {			alert("Please enter a valid email!");			txtEmail.focus();			return false;		}	}	else {		alert("Email must be filled out!");		txtEmail.focus();		return false;	}	if (txtPhone.val() != txtPhone.attr('title') && !validatePhoneNumber(txtPhone.val())) {		txtPhone.focus();		alert("Please enter a valid phone number");		return false;	}	if (txtComments.val() == txtComments.attr('title') && txtComments.val().length > 0) {		alert("Message must be filled out!");		txtComments.focus();		return false;	}	if (txtSecCode.val() == "") {		alert("Security Code must be filled out!");		txtSecCode.focus();		return false;	}	if (txtSecCode.val() != hidSecCode.val()) {		alert("Security Code does not match!");		txtSecCode.focus();		return false;	}	return true;}function validateEmail(email) {	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;	return emailPattern.test(email);}function validatePhoneNumber(elementValue) {	var phoneNumberPattern = /^\(?(\d{1})?\)?[-\. ]?(\d{3})\)?[-\. ]?(\d{3})[-\. ]?(\d{4})$/;	return phoneNumberPattern.test(elementValue);}function validPostalCode(pcode) {	var postalPattern = /^([0-9]{5})|(\s*[a-ceghj-npr-tvxy]\d[a-ceghj-npr-tv-z](\s)?\d[a-ceghj-npr-tv-z]\d\s*)$/i;	var postalRegExp = new RegExp(postalPattern);	debug('postal checking');	if (postalRegExp.test(pcode) == false)		return false;	debug('postal is good');	return true;}
