validateForm = function() {	
var myForm = document.getElementById('frmContact');
if (myForm != undefined && myForm != null) {
       document.getElementById('btnSubmit').onclick = function() {
       var fieldNames = new Array("txtName", "txtEmail", "txtMessage");
	validateForm.prototype._checkForEmptyValue(fieldNames, myForm);
       }
   }
}


validateForm.prototype._checkForEmptyValue = function(textValue, myForm) {
	for (var i = 0; i < textValue.length; i++) {
		if (document.getElementById(textValue[i]).value == "") {
			alert ("Please Enter Your " + document.getElementById(textValue[i]).parentNode.id);
			document.getElementById(textValue[i]).focus();
			return false;
		}
	}
	this._checkValidEmail(myForm);
}

validateForm.prototype._checkValidEmail = function(myForm) {
       var emailValue = document.getElementById('txtEmail').value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(emailValue)){
     	this._submitForm(myForm);
       }
	else
       {
       alert('Email Address Is Incorrect Format.\nExample: inquiry@fmf.com');
       return false;
       }
}

validateForm.prototype._submitForm = function(myForm) {
        myForm.method = "post";
	myForm.action = "/contact.php?submit=yes";
	myForm.submit();	
}