function IsNumber(theString)
{
  var checkOK = "0123456789";
  var checkStr = theString;
  var allValid = 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 += ch;
  }
  if (!allValid)
  {
    return (false);
  }
  return (true);
}
function Quote_Form_Validator(theForm)

{
	var coverage_len = theForm.Coverage.value.length;
  if (!(IsNumber(theForm.Coverage.value)))
  {
    alert("Please enter only digit characters in the Coverage field.");
    theForm.Coverage.focus();
    return (false);
  }
  if (theForm.Coverage.value < 50000 || theForm.Coverage.value > 5000000)
  {
    alert("Please enter a value between $50,000 and $5,000,000 for the Coverage Amount.");
    theForm.Coverage.focus();
    return (false);
  }

   if (coverage_len = 6)
  {

	if (theForm.Coverage.value.substr(3,3) > 0 )
	{
		alert("Please enter a value in multiples of 1000.");
		theForm.Coverage.focus();
		return (false);
	}
  }
    if (coverage_len = 7)
  {

	if (theForm.Coverage.value.substr(4,3) > 0 )
	{
		alert("Please enter a value in multiples of 1000.");
		theForm.Coverage.focus();
		return (false);
	}
  }

  if (theForm.State.value == "none")
  {
    alert("Please select a state. If no states are available, please contact your agent for further assistance.");
    theForm.State.focus();
    return (false);
  }

  if (theForm.Weight.value == "")
  {
    alert("Please enter a value for the Weight field.");
    theForm.Weight.focus();
    return (false);
  }

  if (!(IsNumber(theForm.Weight.value)))
  {
    alert("Please enter only digit characters in the Weight field.");
    theForm.Weight.focus();
    return (false);
  }


  if (theForm.Q1[0].checked == false && theForm.Q1[1].checked == false)
	{
	    alert("Please answer Health Question 1.");
	    return (false);
	}

  if (theForm.Q2[0].checked == false && theForm.Q2[1].checked == false)
	{
	    alert("Please answer Health Question 2.");
	    return (false);
	}
  return (true);
}

