function validateEmail(inValue) {
	var objRegExp = "^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$";
	var objEmailRegExp = new RegExp(objRegExp);
	return objEmailRegExp.test(inValue);
}

function showOrderField() {
	var theRdoBtn = document.Form1.rdoOrderRelated[0];
	var theTable 	= document.getElementById("OrderNum");
	if (theRdoBtn.checked == true && theTable.style.display == 'none') {
		theTable.style.display = 'inline';
	} else if (theRdoBtn.checked == false && theTable.style.display == 'inline') {
		theTable.style.display = 'none';
	}
}

function validateContactForm() {
event.returnValue=true
var theForm = document.Form1;
var FirstError = 0;

	if (FirstError == 0) {
		if(event.returnValue==true && theForm.Fname.value==""){
			alert("Please provide your First Name.")
			theForm.Fname.focus()
			FirstError = 1;
			event.returnValue=false
		}
	}
	
	if (FirstError == 0) {
		if(event.returnValue==true && theForm.Lname.value==""){
			alert("Please provide your Last Name.")
			theForm.Lname.focus()
			FirstError = 1;
			event.returnValue=false
		}
	}

	//var isValidEmail = validateEmail(theForm.Email.value);
	if (FirstError == 0) {
		if(event.returnValue==true  && theForm.Email.value==""){
			alert("Please provide your email address.  This is required to send a message.")
			theForm.Email.focus()
			FirstError = 1;
			event.returnValue=false
		} //else if (!isValidEmail) {
			//alert("The email address you entered does not appear to be valid.  Please try re-entering your email address.\n");
			//theForm.Email.focus()
			//FirstError = 1;
			//event.returnValue=false
		//}
	}
	
	var theTable = document.getElementById("OrderNum");
	if (FirstError == 0) {
		if(event.returnValue==true && theTable.style.display == 'inline') {
			if (theForm.txtOrderNum.value.length == 0) {
				alert("You have indicated that this message is in regards to an order.\nPlease provide the Order number you are inquiring about.");
				theForm.txtOrderNum.focus();
				FirstError = 1;
				event.returnValue=false;
			}
		}
	}
	
	if (FirstError == 0) {
		if (event.returnValue==true && theForm.txtSubject.value.length == 0) {
			alert("Please provide a subject.");
			theForm.txtSubject.focus();
			FirstError = 1;
			event.returnValue=false;
		}
	}
	
	if (FirstError == 0) {
		if (event.returnValue==true && theForm.txtMessage.value.length == 0) {
			alert("Please provide a message.");
			theForm.txtMessage.focus();
			FirstError = 1;
			event.returnValue=false;
		}
	}
}