// JavaScript Document
function ValidateHOForm(theForm)
{

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

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

  if (theForm.Address.value == "")
  {
    alert("Please enter a value for 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.Hydrant.value == "")
  {
    alert("Please enter a value for the \"Hydrant\" field.");
    theForm.Hydrant.focus();
    return (false);
  }

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

  if (theForm.Families.selectedIndex < 0)
  {
    alert("Please select one of the \"Families\" options.");
    theForm.Families.focus();
    return (false);
  }

  if (theForm.Families.selectedIndex == 0)
  {
    alert("The first \"Families\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Families.focus();
    return (false);
  }

  if (theForm.Owner.selectedIndex < 0)
  {
    alert("Please select one of the \"Owner\" options.");
    theForm.Owner.focus();
    return (false);
  }

  if (theForm.Owner.selectedIndex == 0)
  {
    alert("The first \"Owner\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Owner.focus();
    return (false);
  }

  if (theForm.Primary.selectedIndex < 0)
  {
    alert("Please select one of the \"Primary\" options.");
    theForm.Primary.focus();
    return (false);
  }

  if (theForm.Primary.selectedIndex == 0)
  {
    alert("The first \"Primary\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Primary.focus();
    return (false);
  }

  if (theForm.NonSmoker.selectedIndex < 0)
  {
    alert("Please select one of the \"NonSmoker\" options.");
    theForm.NonSmoker.focus();
    return (false);
  }

  if (theForm.NonSmoker.selectedIndex == 0)
  {
    alert("The first \"NonSmoker\" option is not a valid selection.  Please choose one of the other options.");
    theForm.NonSmoker.focus();
    return (false);
  }

  if (theForm.Construction.selectedIndex < 0)
  {
    alert("Please select one of the \"Construction\" options.");
    theForm.Construction.focus();
    return (false);
  }

  if (theForm.Construction.selectedIndex == 0)
  {
    alert("The first \"Construction\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Construction.focus();
    return (false);
  }

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

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

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Dwelling.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 \"Dwelling\" field.");
    theForm.Dwelling.focus();
    return (false);
  }

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

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Market_Value.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 \"Market_Value\" field.");
    theForm.Market_Value.focus();
    return (false);
  }

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

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Jewelry.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 \"Jewelry\" field.");
    theForm.Jewelry.focus();
    return (false);
  }

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

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Furs.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 \"Furs\" field.");
    theForm.Furs.focus();
    return (false);
  }

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

  var checkOK = "0123456789-.,";
  var checkStr = theForm.Fine_Arts.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 \"Fine_Arts\" field.");
    theForm.Fine_Arts.focus();
    return (false);
  }

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

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

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

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

function ValidateAutoForm(theForm)
{

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

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

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

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

  if (theForm.Birthdate_Driver_1.value == "")
  {
    alert("Please enter a value for the \"Date of Birth Driver 1\" field.");
    theForm.Birthdate_Driver_1.focus();
    return (false);
  }

  if (theForm.Year_Driver_1.selectedIndex < 0)
  {
    alert("Please select one of the \"Years Licensed Driver 1\" options.");
    theForm.Year_Driver_1.focus();
    return (false);
  }

  if (theForm.Year_Driver_1.selectedIndex == 0)
  {
    alert("The first \"Years Licensed Driver 1\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Year_Driver_1.focus();
    return (false);
  }

  if (theForm.Year_Vehicle_1.value == "")
  {
    alert("Please enter a value for the \"Model Year Vehicle 1\" field.");
    theForm.Year_Vehicle_1.focus();
    return (false);
  }

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

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

  if (theForm.Garaging_Vehicle_1.value == "")
  {
    alert("Please enter a value for the \"Garaging Vehicle 1\" field.");
    theForm.Garaging_Vehicle_1.focus();
    return (false);
  }
  return (true);
}
