

 //if( Drupal.jsEnabled){
	$(document).ready(function(){
		
			$("#updateTotalButton").click(function(){
				var counter = 2;
				var invalidQuantity = false;
				var nextElement = document.getElementById("quantity1"); 
				invalidQuantity = !isInteger(nextElement.value);
				
				while( nextElement!= null){
					if( !isInteger(nextElement.value) ){
						invalidQuantity = true;
					}
					nextElement = document.getElementById("quantity" + counter);
					counter++;
				}
				if (invalidQuantity){
					alert("Please make sure that you entered integer values for quantities. ");
				} 
				
				counter = 2;
				nextElement = document.getElementById("quantity1"); 
				var locationStr = "updateQuantity.cfm?quantity1=" + nextElement.value;
				var nextElement = document.getElementById("quantity2");
				while( nextElement!= null){
					locationStr =  locationStr + "&quantity" + counter + "=" + nextElement.value;
					counter++;
					nextElement = document.getElementById("quantity" + counter);
				}
				window.location = locationStr;
			});
			
			/*$("#continueButton1").click(function(){
				window.location = "orderInfo";
			});*/
			
			
			
			// functions used when validating quantity	
			 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"))
			   }
			// end functions used when validating quantity
			
	});
 //}