// JavaScript Document
// Validation for cart_display.cfm

    function validForm(passForm) {
       v_error = "The following Problem(s) were found:\n\n";
	   v_valid = true; 	   
	   y = 0;    
       var qfields=document.getElementById("rowKount").value;  
 
           // generic product quantity           
		   for (var x = 0; x <= qfields-1; x++){
		       y = x+1;
			   
			   
		       var formItem=document.getElementById("qty" + y);
               
               switch (isInteger(formItem.value))
               {
                 case true:
                  //alert(formItem.value + " is an integer")
				  
                   break;
                 case false:
                  //alert(formItem.value + " is not an integer")
				  v_valid = false;				  
               }
			   
		   }
		   
		   
       v_error = "The following problem(s) have been found on the form. \n\n One or more Quantity values is not a valid number";
	   if (v_valid == false){alert(v_error)}	   
	  
	   return v_valid;
	   
	}  // end validForm
	


   function isInteger (s)
   {  
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }

   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }

   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }