

function dp(price) 
{
   string = "" + price;
   number = string.length - string.indexOf('.');
   if (string.indexOf('.') == -1)
      return string + '.00';
   if (number == 1)
      return string + '00';
   if (number == 2)
      return string + '0';
   if (number > 3)
      return string.substring(0,string.length-number+3);
return string;
}

function calculate()
{

//alert("ENTRO IN CALCULATE");

document.calcform.total1.value = dp((document.calcform.price1.value)*(document.calcform.quantity1.value))
document.calcform.total2.value = dp((document.calcform.price2.value)*(document.calcform.quantity2.value))
document.calcform.total3.value = dp((document.calcform.price3.value)*(document.calcform.quantity3.value))
document.calcform.total4.value = dp((document.calcform.price4.value)*(document.calcform.quantity4.value))
document.calcform.total5.value = dp((document.calcform.price5.value)*(document.calcform.quantity5.value))
document.calcform.total6.value = dp((document.calcform.price6.value)*(document.calcform.quantity6.value))
/*
document.calcform.total5.value = dp((document.calcform.price5.value)*(document.calcform.quantity5.value))
document.calcform.total6.value = dp((document.calcform.price6.value)*(document.calcform.quantity6.value))
document.calcform.total7.value = dp((document.calcform.price7.value)*(document.calcform.quantity7.value))
document.calcform.total8.value = dp((document.calcform.price8.value)*(document.calcform.quantity8.value))
document.calcform.total9.value = dp((document.calcform.price9.value)*(document.calcform.quantity9.value))
document.calcform.total10.value = dp((document.calcform.price10.value)*(document.calcform.quantity10.value)) */



/*document.calcform.tax.value = dp((document.calcform.subtotal.value)*0.200) */
document.calcform.total.value = dp((document.calcform.subtotal.value)*1.200)
}


function fine() {
//alert(document.calcform.price1.value);
//alert(document.calcform.price2.value);
//alert(document.calcform.price3.value);
//alert(document.calcform.price4.value);
//alert(document.calcform.price5.value);
//alert(document.calcform.price6.value);
document.calcform.subtotal.value = dp(eval(document.calcform.total1.value) + eval(document.calcform.total2.value) + eval(document.calcform.total3.value) + eval(document.calcform.total4.value) + eval(document.calcform.total5.value) + eval(document.calcform.total6.value) /*+ eval(document.calcform.total5.value) + eval(document.calcform.total6.value) + eval(document.calcform.total7.value) + eval(document.calcform.total8.value) + eval(document.calcform.total9.value) + eval(document.calcform.total10.value)*/)
}




