Considera che io so programmare in ASP e non in Javascript

codice:
<script language="javascript">
function somma()
{ 
tot1 = 0
tot2 = 0
tot3 = 0
tot4 = 0
tot5 = 0
tot6 = 0
<% for y = 1 to prodotti %>
var a<%=y%> = document.form1.cost_tot7_1_primo_prod<%=y%>.value.replace(/\,/g,'.');
var b<%=y%> = document.form1.cost_tot7_1_secon_prod<%=y%>.value.replace(/\,/g,'.');
var c<%=y%> = document.form1.cost_tot7_1_terzo_prod<%=y%>.value.replace(/\,/g,'.');
var d<%=y%> = document.form1.cost_tot7_2_primo_prod<%=y%>.value.replace(/\,/g,'.');
var e<%=y%> = document.form1.cost_tot7_2_secon_prod<%=y%>.value.replace(/\,/g,'.');
var f<%=y%> = document.form1.cost_tot7_2_terzo_prod<%=y%>.value.replace(/\,/g,'.');
tot1 = tot1*1+a<%=y%>*1
tot2 = tot2*1+b<%=y%>*1
tot3 = tot3*1+c<%=y%>*1
tot4 = tot4*1+d<%=y%>*1
tot5 = tot5*1+e<%=y%>*1
tot6 = tot6*1+f<%=y%>*1
<% next %>
tot1 =  tot1.replace(/\./,",");
document.form1.total1_7.value=tot1
document.form1.total2_7.value=tot2
document.form1.total3_7.value=tot3
document.form1.total4_7.value=tot4
document.form1.total5_7.value=tot5
document.form1.total6_7.value=tot6
}
</script>