function Form_Validator(theForm)
  {
    var demofail 
    demofail = 0
    if (theForm.strFirstName.value == "")
      {
        alert("Please enter a value for the First Name field.");
        theForm.strFirstName.focus();
        return (false);
      }
    if (theForm.strLastName.value == "")
      {
        alert("Please enter a value for the Last Name field.");
        theForm.strLastName.focus();
        return (false);
      }
/*
    if (theForm.strTitleLiteral.value == "") 
      {
        alert("Please enter a value for the Title field.");
        theForm.strTitleLiteral.focus();
        return (false);
      }
*/      
    if (theForm.strCompany.value == "")
      {
        alert("Please enter a value for the Establishment field.");
        theForm.strCompany.focus();
        return (false);
      }
    if (theForm.strAddress1_1.value == "")
      {
        alert("Please enter a value for the Address field.");
        theForm.strAddress1_1.focus();
        return (false);
      }
    if (theForm.strCity.value == "")
      {
        alert("Please enter a value for the City field.");
        theForm.strCity.focus();
        return (false);
      }
    if (theForm.strDummy1.options[theForm.strDummy1.selectedIndex].value == "--")
      {
        alert("Please select a valid State.");
        theForm.strDummy1.focus();
        return (false);
      }
    else
      {
        var str = theForm.strDummy1.options[theForm.strDummy1.selectedIndex].value;
        theForm.strState.value = str.substring(0,2);
        theForm.lngForeignStCode.value = str.substring(2);
      }
    if (theForm.strZip.value == "")
      {
        alert("Please enter a value for the Zip Code field.");
        theForm.strZip.focus();
        return (false);
      }
    if (theForm.strZip.value.length != 5)
      {
        alert("Please enter 5 characters in the Zip Code field.");
        theForm.strZip.focus();
        return (false);
      }
    var checkOK = "0123456789";
    var checkStr = theForm.strZip.value;
    var allValid = true;
    var validGroups = true;
    var decPoints = 0;
    var allNum = "";
    for (i = 0;  i < checkStr.length;  i++)
      {
        ch = checkStr.charAt(i);
        for (j = 0;  j < checkOK.length;  j++)
          if (ch == checkOK.charAt(j))
            break;
        if (j == checkOK.length)
        {
          allValid = false;
          break;
        }
        allNum += ch;
      }
    if (!allValid)
      {
        alert("Please enter only digit characters in the Zip Code field.");
        theForm.strZip.focus();
        return (false);
      }
      if (str.substring(2) == "061") {
          if (
              ((theForm.strZip.value.substring(0, 3) > "089") && (theForm.strZip.value.substring(0, 3) < "093")) ||
              ((theForm.strZip.value.substring(0, 3) > "093") && (theForm.strZip.value.substring(0, 3) < "100"))
              ) {
          }
          else {
              alert("Your postal code does not match the selected state")
              theForm.strZip.focus();
              return (false);
          }
      }
      else if (str.substring(2) == "062") {
          if (theForm.strZip.value.substring(0, 3) != "093") {
              alert("Your postal code does not match the selected state")
              theForm.strZip.focus();
              return (false);
          }
      }
      else if (str.substring(2) == "063") {
          if ((theForm.strZip.value.substring(0, 3) < "962") || (theForm.strZip.value.substring(0, 3) > "966")) {
              alert("Your postal code does not match the selected state")
              theForm.strZip.focus();
              return (false);
          }
      }
      else if (str.substring(2) == "064") {
          if (theForm.strZip.value.substring(0, 3) != "340") {
              alert("Your postal code does not match the selected state")
              theForm.strZip.focus();
              return (false);
          }
      }

      /*
      if (theForm.strPhone.value.length != 10) {
          alert("Please enter 10 digits in the Phone field.  Enter only numbers, no spaces or dashes.");
          theForm.strPhone.focus();
          return (false);
      }
      if (theForm.strFax.value.length != 10) {
          alert("Please enter 10 digits in the Fax field.  Enter only numbers, no spaces or dashes.");
          theForm.strFax.focus();
          return (false);
      }
      */
    if (theForm.strEmail.value == "")
      {
        alert("Please enter a value for the Email field.");
        theForm.strEmail.focus();
        return (false);
      }
    if (theForm.strEmail.value.length > 65)
      {
        alert("Please enter at most 65 characters in the Email field.");
        theForm.strEmail.focus();
        return (false);
      }
    var strEmail = theForm.strEmail.value;
    var i=strEmail.indexOf("@");	//see if there's an @ sign
    var x=strEmail.indexOf("@",i+1); //make sure there's not more @ signs
    var p=strEmail.indexOf(".",i);  //there must be a period 
 
    if ( (i==-1) || (p<(i+2)) || (x>i) || (p >=(strEmail.length - 2)))
      {
        alert("Please enter a valid Email Address.");
        theForm.strEmail.focus();
        return(false);
      }
    if (theForm.strExpDemo5[0].checked == false && theForm.strExpDemo5[1].checked == false) 
      {
        alert("Please select which version you would like to receive.");
        theForm.strExpDemo5[0].focus();
        return (false);
      }

    if (theForm.lngPriIndCode.selectedIndex < 0)
      {
        alert("Please select one of the Type of Establishment options.");
        theForm.lngPriIndCode.focus();
        return (false);
      }
    if (theForm.lngPriIndCode.options[theForm.lngPriIndCode.selectedIndex].value == "--")
      {
        alert("Please select a valid Type of Establishment option.");
        theForm.lngPriIndCode.focus();
        return (false);
      }
    if (theForm.lngPriIndCode.options[theForm.lngPriIndCode.selectedIndex].value == "21")
      {
        if (theForm.strPriIndCodeOther.value.length == 0)
          {
            alert("The Type of Establishment - Other field cannot be blank when Other is chosen for Type of Establishment.");
            theForm.strPriIndCodeOther.focus();
            return (false);
          }
      }

    if (theForm.lngTitle.selectedIndex < 0)
      {
        alert("Please select one of the Title options.");
        theForm.lngTitle.focus();
        return (false);
      }
    if (theForm.lngTitle.options[theForm.lngTitle.selectedIndex].value == "--")
      {
        alert("Please select a valid Title option.");
        theForm.lngTitle.focus();
        return (false);
      }

    if (theForm.lngTitle.options[theForm.lngTitle.selectedIndex].value == "020")
      {
        if (theForm.strTitleOther.value.length == 0)
          {
            alert("The Title - Other field cannot be blank when Other is chosen for Title.");
            theForm.strTitleOther.focus();
            return (false);
          }
      }
    /*
    if (theForm.strExpDemo1[0].checked == false && theForm.strExpDemo1[1].checked == false)
      {
        alert("Please select one of the Do You Sell Liquor? options.");
        theForm.strExpDemo1[0].focus();
        return (false);
      }
    if (theForm.strExpDemo2[0].checked == false && theForm.strExpDemo2[1].checked == false)
      {
        alert("Please select one of the Do You Sell Beer? options.");
        theForm.strExpDemo2[0].focus();
        return (false);
      }
    if (theForm.lngSourceID.selectedIndex < 0)
      {
        alert("Please select one of the Annual Sales options.");
        theForm.lngSourceID.focus();
        return (false);
      }
    if (theForm.lngSourceID.options[theForm.lngSourceID.selectedIndex].value == "--")
      {
        alert("Please select a valid Annual Sales option.");
        theForm.lngSourceID.focus();
        return (false);
      }
    */

    if (theForm.strVerificationQuestion.selectedIndex < 0)
      {
        alert("Please select one of the Units Under Your Direction options.");
        theForm.strVerificationQuestion.focus();
        return (false);
      }
    if (theForm.strVerificationQuestion.options[theForm.strVerificationQuestion.selectedIndex].value == "--")
      {
        alert("Please select a valid Eye Color option.");
        theForm.strVerificationQuestion.focus();
        return (false);
      }

    if (theForm.lngPriIndCode.options[theForm.lngPriIndCode.selectedIndex].value == "21")
      {
        demofail = "1"
      }
    if (theForm.lngTitle.options[theForm.lngTitle.selectedIndex].value == "020")
      {
        demofail = "1"
      }
    if (demofail == 0)
      {
      }
    else
      {
        theForm.lngList.value = "7"
//        theForm.action = "nonqualify.asp";
      }

    theForm.blnProcess.value = 1;
    return (true);
  }

