function FrontPage_Form1_Validator(theForm)
{

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

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

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

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

  var chkVal = allNum;
  var prsVal = parseInt(allNum);
  if (chkVal != "" && !(prsVal >= "10" && prsVal <= "2008"))
  {
    alert("Please enter a value greater than or equal to \"10\" and less than or equal to \"2008\" in the \"Year\" field.");
    theForm.year.focus();
    return (false);
  }

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

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

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

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

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

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

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

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

  if (theForm.body_style.value.length > 40)
  {
    alert("Please enter at most 40 characters in the \"Body Style\" field.");
    theForm.body_style.focus();
    return (false);
  }
	if (theForm.num_doors.selectedIndex < 1)
	{
		alert("Please select number of doors.");
   		theForm.num_doors.focus();
	    return (false);
	}
	if (theForm.tint_pref_id.selectedIndex < 1)
	{
		alert("Please select tint preference.");
   		theForm.tint_pref_id.focus();
	    return (false);
	}
	if (theForm.part_id.selectedIndex < 1)
	{
		alert("Please select part needed.");
   		theForm.part_id.focus();
	    return (false);
	}
	
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    theForm.email.focus();
    return (false);
  }

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

  if (theForm.email.value.length > 80)
  {
    alert("Please enter at most 80 characters in the \"email\" field.");
    theForm.email.focus();
    return (false);
  }
	if (!isValidEmail(theForm.email.value))
	{
		alert("Please enter a valid email address.");
		theForm.email.focus();
		theForm.email.select();
		return false;
	}
  if (undefined != theForm.email2)
  {
	  if (theForm.email2.value == '')
	  {
		  alert("Please retype your email address.");
		  theForm.email2.focus();
		  return false;
	  }
	  if (theForm.email.value != theForm.email2.value)
	  {
		  alert("Email doesn't match the retyped email.");
		  theForm.email2.focus();
		  return false;
	  }
  }

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

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

  if (theForm.zip.value.length > 15)
  {
    alert("Please enter at most 15 characters in the \"ZIP Code\" field.");
    theForm.zip.focus();
    return (false);
  }
  if (undefined != theForm.price)
  {
	  if (theForm.price.value == 0 || !isNumeric(theForm.price.value))
	  {
		  alert("Please enter a valid price.");
		  theForm.price.focus();
		  return false;
	  }
  }
  return (true);
}
