
function is_email(email){
//  re=/[\w\.]+@[\w\.]+\.\w{2,}/;
  re= /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  if(!re.test(email)) return false;
  return true;
}

function check_form() {
  var theForm = document.warranty;
  if (theForm.firstName.value == 0)
    {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)
    {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.address1.value == 0)
    {  alert("Please enter your address"); theForm.address1.focus(); return(false); }
  if (theForm.city.value == 0)
    {  alert("Please enter the city you live in"); theForm.city.focus(); return(false); }
  if (theForm.zipcode.value == 0)
    {  alert("Please enter the zipcode"); theForm.zipcode.focus(); return(false); }
  if (theForm.country.value == "dr" || theForm.country.value == "")
    {  alert("Please enter the country you live in"); theForm.country.focus(); return(false); }
  if (theForm.phone.value == 0)
    {  alert("Please enter your phone"); theForm.phone.focus(); return(false); }
  if (theForm.email.value == 0)
    {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    {  
      alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
  if (theForm.serial.value == 0)
    {  alert("Please enter the serial number of model"); theForm.serial.focus(); return(false); }
  if (theForm.unit.value == 0)
    {  alert("Please enter the unit model"); theForm.unit.focus(); return(false); }
  if (theForm.date.value == 0)
    {  alert("Please enter the date of purchase"); theForm.date.focus(); return(false); }

  if (theForm.vercode.value == 0)
    {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }

  if (theForm.store.value == 0)
    {  
      alert("Please enter the store where the unit was purchased"); 
      theForm.store.focus(); 
      return(false); 
    }
  theForm.submit();
}

function check_form_request() {
  var theForm = document.requestcat;
  if (theForm.firstName.value == 0)
    {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)
    {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.address1.value == 0)
    {  alert("Please enter your address"); theForm.address1.focus(); return(false); }
  if (theForm.city.value == 0)
    {  alert("Please enter the city you live in"); theForm.city.focus(); return(false); }
  if (theForm.zipcode.value == 0)
    {  alert("Please enter the zipcode"); theForm.zipcode.focus(); return(false); }
  if (theForm.country.value == "dr" || theForm.country.value == "")
    {  alert("Please enter the country you live in"); theForm.country.focus(); return(false); }
  if (theForm.phone.value == 0)
    {  alert("Please enter your phone"); theForm.phone.focus(); return(false); }
  if (theForm.email.value == 0)
    {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    {  
      alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
  if (theForm.choice.value == "" || theForm.choice.value == 0)
    {  alert("Please enter the choice"); theForm.choice.focus(); return(false); }

  if (theForm.vercode.value == 0)
    {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }

  theForm.submit();
}

function check_form_gov_request() {
  var theForm = document.govrequest;
  if (theForm.date.value == 0) {  alert("Please select Entry Date"); theForm.date.focus(); return(false); }
  if (theForm.agencytype.value == 0){  alert("Please enter the Agency Type"); theForm.agencytype.focus(); return(false); }
  if (theForm.govagency.value == 0) {  alert("Please enter the Government Agency"); theForm.govagency.focus(); return(false); }
  if (theForm.firstName.value == 0) {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)  {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.title.value == 0)     {  alert("Please enter the Title"); theForm.title.focus(); return(false); }
  if (theForm.address1.value == 0)  {  alert("Please enter the address"); theForm.address1.focus(); return(false); }
  if (theForm.city.value == 0)      {  alert("Please enter the city"); theForm.city.focus(); return(false); }
  if (theForm.state.value == 0)     {  alert("Please select the State"); theForm.state.focus(); return(false); }
  if (theForm.zipcode.value == 0)   {  alert("Please enter the zipcode"); theForm.zipcode.focus(); return(false); }
  if (theForm.phone.value == 0)     {  alert("Please enter your phone"); theForm.phone.focus(); return(false); }
  if (theForm.email.value == 0)     {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    { alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
  if (theForm.howhear.value == 0) {  alert("Please write How did you hear about us?"); theForm.howhear.focus(); return(false); }
  if (theForm.vercode.value == 0) {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }
  theForm.submit();
}

function check_form_subscribe(unsub) {
  var theForm = document.subscribe;
  if (theForm.firstName.value == 0)
    {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)
    {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.email.value == 0)
    {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    {  
      alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
  if (theForm.vercode.value == 0)
    {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }

  theForm.unsubscribe.value=unsub;
  theForm.submit();
}

function check_form_serviceshipping() {
  var theForm = document.serviceshipping;
  var re = /^[0-9]*\.?[0-9]*$/;
  if (theForm.firstName.value == 0)
    {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)
    {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.rma.value == 0)
    {  alert("Please enter your RMA number"); theForm.rma.focus(); return(false); }
  if (theForm.amount.value == 0 || !re.test(theForm.amount.value ))
    {  alert("Please enter the correct amount"); theForm.amount.focus(); return(false); }
  if (theForm.phone.value == 0)
    {  alert("Please enter your phone"); theForm.phone.focus(); return(false); }    
  if (theForm.email.value == 0)
    {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    {  
      alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
    
  if (theForm.vercode.value == 0)
    {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }

//  theForm.submit();
    return(true); 
    
}

function check_form_return() {
  var theForm = document.returnproduct;
  if (theForm.firstName.value == 0)
    {  alert("Please enter your first name"); theForm.firstName.focus(); return(false); }
  if (theForm.lastName.value == 0)
    {  alert("Please enter your last name"); theForm.lastName.focus(); return(false); }
  if (theForm.address1.value == 0)
    {  alert("Please enter your address"); theForm.address1.focus(); return(false); }
  if (theForm.city.value == 0)
    {  alert("Please enter the city you live in"); theForm.city.focus(); return(false); }
  if (theForm.zipcode.value == 0)
    {  alert("Please enter the zipcode"); theForm.zipcode.focus(); return(false); }
  if (theForm.country.value == "dr" || theForm.country.value == "")
    {  alert("Please enter the country you live in"); theForm.country.focus(); return(false); }
  if (theForm.phone.value == 0)
    {  alert("Please enter your phone"); theForm.phone.focus(); return(false); }
  if (theForm.email.value == 0)
    {  alert("Please enter your email address"); theForm.email.focus(); return(false); }
  if (!is_email(theForm.email.value))
    {  
      alert("It seems your email address is not valid.\nPlease enter it again."); 
      theForm.email.focus(); 
      return(false); 
    }
  if (theForm.unit.value == 0)
    {  alert("Please enter the unit model"); theForm.unit.focus(); return(false); }
  if (theForm.date.value == 0)
    {  alert("Please enter the date of purchase"); theForm.date.focus(); return(false); }
  if (theForm.store.value == 0)
    {  
      alert("Please enter the store where the unit was purchased"); 
      theForm.store.focus(); 
      return(false); 
    }

  if (theForm.vercode.value == 0)
    {  alert("Please enter the numbers from the spam-prevention image"); theForm.vercode.focus(); return(false); }

  theForm.submit();
}
