
//-----------------------------------------------------------------------------------------			 
// Called by the onBlur for form quantities.

function ValidateQuantity(cnt,theform) {

	   qty = cnt.value;
       qtyb = theform.hiddenquantity.value;

	   if (qty!="") { 
			 if (isInteger(qty)==false) {
			     alert("Please enter a valid quantity!")
				 cnt.value=qtyb;
				 cnt.focus();
				 return true;
			     }
			 
			 if (qty==0) {
			     alert("Please enter a valid quantity!")
				 cnt.value=qtyb;
				 cnt.focus();
				 return true;
			     }
			 
			 if (qty>200) {
			     alert("Please enter a valid quantity! (Less then 200 units)")
				 cnt.value=qtyb;
				 cnt.focus();
				 return true;
		    	 }
		 }
		 theform.hiddenquantity.value = qty
	 }
	 
//-----------------------------------------------------------------------------------------			 

function Detail_ValidateForm() {

	    theform = document.formproduct;
		qty = theform.Quantity.value;
		 
		 if (isInteger(qty)==false) {
		     alert("Please enter a valid quantity!")
			 theform.Quantity.value='';
			 theform.Quantity.focus();
			 return true;
		     }
		 
		 if (qty==0) {
		     alert("Please enter a valid quantity!")
			 theform.Quantity.value='';
			 theform.Quantity.focus();
			 return true;
		 }
		 
		 theform.submit();
		}

//-----------------------------------------------------------------------------------------		
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

//-----------------------------------------------------------------------------------------

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
