function calculate(quantity,quantityname,pricePerItem,pricename) {
/*
alert(quantity);
alert(quantityname);
alert(pricePerItem);
alert(pricename);
*/

newprice = pricePerItem * quantity;
newprice = "$" + newprice + ".00";
pricename.value = newprice;

var total = 0;
total = Number(total);

for(i=0; i<document.forms[0].elements.length; i++){
   var price = document.forms[0].elements[i].name;
	   if (price.indexOf("price")!=-1){
	      
		dollarvalue = document.forms[0].elements[i].value;
		newdollarvalue = dollarvalue.substring(1, dollarvalue.length);
		newdollarvalue = Number(newdollarvalue);
		total = total + newdollarvalue;
	   }
	}
total = "$" + total + ".00";

document.products.total.value =  total;
}
