// JavaScript Document

//#################FORM VALIDATOR###################
//##################################################
function validateForm(){
	var email = document.my_form.email.value;
	var AtPos = email.indexOf("@");
	var StopPos = email.lastIndexOf(".");
	
	if (document.my_form.name1.value <2) {
		alert("You have not filled in the NAME field.");
		document.my_form.name1.focus();
		return false;
	}
	
	if (email == "") {
	alert("You have not enterd a valid EMAIL ADDRESS.");
	document.my_form.email.focus();
	return false;
	}
	
	if (AtPos == -1 || StopPos == -1) {
	alert("You have not enterd a valid EMAIL ADDRESS.");
	document.my_form.email.focus();
	return false;
	}
	
	if (StopPos < AtPos) {
	alert("You have not enterd a valid EMAIL ADDRESS.");
	document.my_form.email.focus();
	return false;
	}
	
	if (StopPos - AtPos == 1) {
	alert("You have not enterd a valid EMAIL ADDRESS.");
	document.my_form.email.focus();
	return false;
	}
	
	if (document.my_form.phone.value <2) {
		alert("You have not filled in the PHONE field.");
		document.my_form.phone.focus();
		return false;
	}
	
	{
   if(document.my_form.phone.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
      return false;
   }
}

	return true;
}
