//var desktop;
//function openWindow(url,w,h){
//if (desktop && desktop.location) desktop.close();
//desktop = window.open(url, "_blank","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width="+w+",height="+h);
//}
function FormValidator(theForm)
{
  if (theForm.vehicletype.value == "")
  {
    alert("Please enter a value for the \"Type\" field.");
    theForm.vehicletype.focus();
    return (false);
  }
  if (theForm.make.value == "")
  {
    alert("Please enter a value for 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.caryear.value == "")
  {
    alert("Please enter a value for the \"Year\" field.");
    theForm.caryear.focus();
    return (false);
  }
  if (isNaN(theForm.caryear.value))
  {
    alert("Year - Numeric Only.");
    theForm.caryear.focus();
    return (false);
  }
  if (theForm.mileage.value == "")
  {
    alert("Please enter a value for the \"Mileage\" field.");
    theForm.mileage.focus();
    return (false);
  }
    if (isNaN(theForm.mileage.value))
  {
    alert("Mileage - Numeric Only. No commas or dollar signs");
    theForm.mileage.focus();
    return (false);
  }
  
  if (theForm.color.value == "")
  {
    alert("Please enter a value for the \"Color\" field.");
    theForm.color.focus();
    return (false);
  }
  if (theForm.condition.value == "")
  {
    alert("Please enter a value for the \"Condition\" field.");
    theForm.condition.focus();
    return (false);
  }
  if (theForm.estimatedvalue.value == "")
  {
    alert("Please enter a value for the \"Estimated Value\" field.");
    theForm.estimatedvalue.focus();
    return (false);
  }
    if (isNaN(theForm.estimatedvalue.value))
  {
    alert("Estimated Value - Numeric Only. No commas or dollar signs");
    theForm.estimatedvalue.focus();
    return (false);
  }

  if (theForm.requesttype.value == "")
  {
    alert("Please enter a value for the \"Request Type\" field.");
    theForm.requesttype.focus();
    return (false);
  }
  if (theForm.firstname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.firstname.focus();
    return (false);
  }
  if (theForm.lastname.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.lastname.focus();
    return (false);
  }
  var FmtStr="";
  var index = 0;
  var LimitCheck;
  var checkStr = theForm.phone.value;
  LimitCheck = checkStr.length;
  while (index != LimitCheck)
  {
   if (isNaN(parseInt(checkStr.charAt(index))))
    { }
   else
    { FmtStr = FmtStr + checkStr.charAt(index); }
   index = index + 1;
  }
  if (FmtStr.length != 10)
  {
    alert("Error - Phone ... U.S. phone numbers have exactly ten digits.");
    theForm.phone.focus();
    return (false);
  }
  var FmtStr="";
  var index = 0;
  var LimitCheck;
  var checkStr = theForm.otherphone.value;
  LimitCheck = checkStr.length;
  while (index != LimitCheck)
  {
   if (isNaN(parseInt(checkStr.charAt(index))))
    { }
   else
    { FmtStr = FmtStr + checkStr.charAt(index); }
   index = index + 1;
  }
  if (FmtStr.length != 10)
  {
    alert("Error - Other Phone ... U.S. phone numbers have exactly ten digits.");
    theForm.otherphone.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.state.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.state.focus();
    return (false);
  }
  if (theForm.zipcode.value == "")
  {
    alert("Please enter a value for the \"ZipCode\" field.");
    theForm.zipcode.focus();
    return (false);
  }
  return (true);  
}