


function getTotal(aForm) {

	var total = 0;
	var length = aForm.recordCount.value;
	
	//alert(length);
	
	for (var i=0; i<length; i++) {
	
		if (length > 1) {
		
			var price = aForm.price[i].value;
			var quantity = aForm.quantity[i].value;
			if (quantity == "") { quantity = 0; }
			total = total + (price * quantity);
		}
		
		else if (length == 1) {
		
			var price = aForm.price.value;
			var quantity = aForm.quantity.value;
			if (quantity == "") { quantity = 0; }
			total = total + (price * quantity);		
		}
		
	}//end for loop
	
	aForm.gTotal.value = "$" + total;
	
	if (aForm.gTotal.value == "$NaN") { aForm.gTotal.value = "ERROR" }

}//end function


