// JavaScript Order Form validation
function Form_Validator(theForm)
{
	
 	if (theForm.Name.value == "")
  {
    alert("Please enter your Name");
    theForm.Name.focus();
    return (false);
  }
	if (theForm.Address.value == "")
  {
    alert("Please enter Address");
    theForm.Address.focus();
    return (false);
  }
	if (theForm.City.value == "")
  {
    alert("Please enter a City");
    theForm.City.focus();
    return (false);
  }
   if (theForm.State.value == "Select")
  {
    alert("Please select a state");
    theForm.State.focus();
    return (false);
  }
	if (theForm.Zip_Code.value == "")
  {
    alert("Please enter a Zip Code");
    theForm.Zip_Code.focus();
    return (false);
  }
	if (theForm.Phone_Number.value == "")
  {
    alert("Please enter a Phone Number ");
    theForm.Phone_Number.focus();
    return (false);
  }
  if (theForm.Fax_Number.value == "")
  {
    alert("Please enter a Fax Number ");
    theForm.Fax_Number.focus();
    return (false);
  }
  if (theForm.Email.value.length == 0) {
    alert("Please fill in the E-mail address");
    theForm.Email.focus();
    return false;
  }
  re = /^[a-zA-Z0-9_.\-]+@[a-zA-Z0-9.\-]+[a-zA-Z0-9\-]\.[a-zA-Z][a-zA-Z]+$/;
  if (!re.test(theForm.Email.value)) {
    alert("Please fill in a correct E-mail address");
    theForm.Email.focus();
    return false;
  }	

   return (true);
}


function Order_Validator(theForm)
{
	
 	if (theForm.partsreferenceNo.value == "")
  {
    alert("Please enter a Purchase Order or Refernce Number");
    theForm.partsreferenceNo.focus();
    return (false);
  }
	if (theForm.customer_name.value == "")
  {
    alert("Please enter your Company Name");
    theForm.customer_name.focus();
    return (false);
  }
	if (theForm.billtoaddress.value == "")
  {
    alert("Please enter Address");
    theForm.billtoaddress.focus();
    return (false);
  }
	if (theForm.billtocityStateZip.value == "")
  {
    alert("Please enter a City, State, and Zip Code");
    theForm.billtocityStateZip.focus();
    return (false);
  }
   if (theForm.billtocontact.value == "")
  {
    alert("Please enter a Contact Name");
    theForm.billtocontact.focus();
    return (false);
  }
	if (theForm.billtophone.value == "")
  {
    alert("Please enter a Phone Number");
    theForm.billtophone.focus();
    return (false);
  }
	  
  if (theForm.email.value.length == 0) {
    alert("Please fill in the E-mail address");
    theForm.email.focus();
    return false;
  }
  re = /^[a-zA-Z0-9_.\-]+@[a-zA-Z0-9.\-]+[a-zA-Z0-9\-]\.[a-zA-Z][a-zA-Z]+$/;
  if (!re.test(theForm.email.value)) {
    alert("Please fill in a correct E-mail address");
    theForm.email.focus();
    return false;
  }	

if (theForm.shiptoname.value == "")
  {
    alert("Please enter your Company Name");
    theForm.shiptoname.focus();
    return (false);
  }
	if (theForm.shiptoaddress.value == "")
  {
    alert("Please enter Address");
    theForm.shiptoaddress.focus();
    return (false);
  }
	if (theForm.shiptocityStateZip.value == "")
  {
    alert("Please enter a City, State, and Zip Code");
    theForm.shiptocityStateZip.focus();
    return (false);
  }
   if (theForm.shiptocontact.value == "")
  {
    alert("Please enter a Contact Name");
    theForm.shiptocontact.focus();
    return (false);
  }
	if (theForm.shiptophone.value == "")
  {
    alert("Please enter a Phone Number");
    theForm.shiptophone.focus();
    return (false);
  }
   if (theForm.shipVia.value == "")
  {
    alert("Please enter a method of shipment");
    theForm.shipVia.focus();
    return (false);
  }
   
   return (true);
}