﻿function validator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Name.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Address.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.Address.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.Address.value.length > 75)
  {
    alert("Please enter at most 75 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.City.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.State.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.State.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"State\" field.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.Zip.value == "")
  {
    alert("Please enter a value for the \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Zip.value.length > 5)
  {
    alert("Please enter at most 5 characters in the \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Zip.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;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch == "," && decPoints != 0)
    {
      validGroups = false;
      break;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (decPoints > 1 || !validGroups)
  {
    alert("Please enter a valid number in the \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Home_Phone.value == "")
  {
    alert("Please enter a value for the \"Home_Phone\" field.");
    theForm.Home_Phone.focus();
    return (false);
  }

  if (theForm.Home_Phone.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Home_Phone\" field.");
    theForm.Home_Phone.focus();
    return (false);
  }

  if (theForm.Home_Phone.value.length > 13)
  {
    alert("Please enter at most 13 characters in the \"Home_Phone\" field.");
    theForm.Home_Phone.focus();
    return (false);
  }

  if (theForm.Position.value == "")
  {
    alert("Please enter a value for the \"Position\" field.");
    theForm.Position.focus();
    return (false);
  }

  if (theForm.Wage_Desired.value == "")
  {
    alert("Please enter a value for the \"Wage_Desired\" field.");
    theForm.Wage_Desired.focus();
    return (false);
  }

  if (theForm.Wage_Desired.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Wage_Desired\" field.");
    theForm.Wage_Desired.focus();
    return (false);
  }

  if (theForm.Wage_Desired.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Wage_Desired\" field.");
    theForm.Wage_Desired.focus();
    return (false);
  }

  if (theForm.Start_Date.value == "")
  {
    alert("Please enter a value for the \"Start_Date\" field.");
    theForm.Start_Date.focus();
    return (false);
  }

  if (theForm.Start_Date.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Start_Date\" field.");
    theForm.Start_Date.focus();
    return (false);
  }

  if (theForm.Start_Date.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Start_Date\" field.");
    theForm.Start_Date.focus();
    return (false);
  }

  if (theForm.Friday_Start.value == "")
  {
    alert("Please enter a value for the \"Friday_Start\" field.");
    theForm.Friday_Start.focus();
    return (false);
  }

  if (theForm.Saturday_Start.value == "")
  {
    alert("Please enter a value for the \"Saturday_Start\" field.");
    theForm.Saturday_Start.focus();
    return (false);
  }

  if (theForm.Sunday_Start.value == "")
  {
    alert("Please enter a value for the \"Sunday_Start\" field.");
    theForm.Sunday_Start.focus();
    return (false);
  }

  if (theForm.Monday_Start.value == "")
  {
    alert("Please enter a value for the \"Monday_Start\" field.");
    theForm.Monday_Start.focus();
    return (false);
  }

  if (theForm.Tuesday_Start.value == "")
  {
    alert("Please enter a value for the \"Tuesday_Start\" field.");
    theForm.Tuesday_Start.focus();
    return (false);
  }

  if (theForm.Wednesday_Start.value == "")
  {
    alert("Please enter a value for the \"Wednesday_Start\" field.");
    theForm.Wednesday_Start.focus();
    return (false);
  }

  if (theForm.Thursday_Start.value == "")
  {
    alert("Please enter a value for the \"Thursday_Start\" field.");
    theForm.Thursday_Start.focus();
    return (false);
  }

  if (theForm.Friday_End.value == "")
  {
    alert("Please enter a value for the \"Friday_End\" field.");
    theForm.Friday_End.focus();
    return (false);
  }

  if (theForm.Saturday_End.value == "")
  {
    alert("Please enter a value for the \"Saturday_End\" field.");
    theForm.Saturday_End.focus();
    return (false);
  }

  if (theForm.Sunday_End.value == "")
  {
    alert("Please enter a value for the \"Sunday_End\" field.");
    theForm.Sunday_End.focus();
    return (false);
  }

  if (theForm.Monday_End.value == "")
  {
    alert("Please enter a value for the \"Monday_End\" field.");
    theForm.Monday_End.focus();
    return (false);
  }

  if (theForm.Tuesday_End.value == "")
  {
    alert("Please enter a value for the \"Tuesday_End\" field.");
    theForm.Tuesday_End.focus();
    return (false);
  }

  if (theForm.Wednesday_End.value == "")
  {
    alert("Please enter a value for the \"Wednesday_End\" field.");
    theForm.Wednesday_End.focus();
    return (false);
  }

  if (theForm.Thursday_End.value == "")
  {
    alert("Please enter a value for the \"Thursday_End\" field.");
    theForm.Thursday_End.focus();
    return (false);
  }

  if (theForm.Employment_Investigation_Agreement_Date.value == "")
  {
    alert("Please enter a value for the \"Employment_Investigation_Agreement_Date\" field.");
    theForm.Employment_Investigation_Agreement_Date.focus();
    return (false);
  }

  if (theForm.Employment_Investigation_Agreement_Date.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Employment_Investigation_Agreement_Date\" field.");
    theForm.Employment_Investigation_Agreement_Date.focus();
    return (false);
  }

  if (theForm.Employment_Investigation_Agreement_Date.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Employment_Investigation_Agreement_Date\" field.");
    theForm.Employment_Investigation_Agreement_Date.focus();
    return (false);
  }

  if (theForm.Employment_At_Will_Agree_Date.value == "")
  {
    alert("Please enter a value for the \"Employment_At_Will_Agree_Date\" field.");
    theForm.Employment_At_Will_Agree_Date.focus();
    return (false);
  }

  if (theForm.Employment_At_Will_Agree_Date.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Employment_At_Will_Agree_Date\" field.");
    theForm.Employment_At_Will_Agree_Date.focus();
    return (false);
  }

  if (theForm.Employment_At_Will_Agree_Date.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Employment_At_Will_Agree_Date\" field.");
    theForm.Employment_At_Will_Agree_Date.focus();
    return (false);
  }
  return (true);
}
