//	------------------------------------------------------------------------------
//	------------------------------------------------------------------------------
//	||	FORMVALIDATOR.JS	:	FORM_VALIDATOR() DECLARATION/IMPLEMENTATION		||				
//	||																			||
//	||	Description			:	verifies positive integer input from form		||		
//	||							rejects values that are not numbers.			||
//	||																			||
//	||	Input				:	an int value									||
//	||																			||
//	||	Output				:	interactive error message						||
//	||																			||
//	||	Application			:	www.goodpet.com									||
//	||	File				:	formValidotor.js								||
//	||	Functions			:	Form_Validator									||
//	||																			||
//	||	Revisions			:	1.0 (theForm)									||
//	||																			||
//	||																			||
//	||	Environment			:	MS Visual Dev									||
//	||																			||
//	||	Author				:	Kenneth Ryan									||
//	||	Date				:	1998/09/02										||
//	||																			||
//	------------------------------------------------------------------------------
//	------------------------------------------------------------------------------



//	-----------------------------------------------------------------------------
//	|	Function	:	Form_Validator											|
//	|	Input		:	text box value											|
//	|	Output		:	interactive error handling								|
//	|	Purpose		:	verify that user entered positive int value in text box	|
//	|																			|
//	-----------------------------------------------------------------------------
function Form_Validator(theForm)
{
  var checkOK = "0123456789-";
  var checkStr = theForm.Qty.value;
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digit characters in the \"Qty\" field.");
    theForm.Qty.focus();
    return (false);
  }

  var chkVal = allNum;
  var prsVal = parseInt(allNum);
  if (chkVal != "" && !(prsVal >= "0"))
  {
    alert("Please enter a value greater than or equal to \"0\" in the \"Qty\" field.");
    theForm.Qty.focus();
    return (false);
  }


  if (theForm.Qty.value == "")
  {
    alert("Please enter a value greater than or equal to \"0\" in the \"Qty\" field.");
    theForm.Qty.focus();
    return (false);
  }

  return (true);
}

