buenas tardes estoy haciend un modulo de facturacion al cual le hice un bucle para poder ingresar varios registros al mismo tiempo

hasta hay todo bien le colo un script que es de una suma automatica al cual al hacer el bucle para la fila nueva ya no me genera la suma ni la sumatoria total... alguien que me pueda ayudar he investidado y todavia no pasa lada dejo aqui el codigo espero me puedan ayudar
Código HTML:
Ver original<script language="JavaScript" type="text/JavaScript"> <!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
<script language="javascript">
function abrirCaja()
{
posx=((screen.availWidth-320)/2)
posy=((screen.availHeight-200)/2)
eval("boxwindow=window.open('ticket.php','boxwindow','width=320,height=400,toolbar=0,directories=0,status=0,scrollbars=0,resize=0,menubar=0,screenx="+posx+",screeny="+posy+",left="+posx+",top="+posy+"')")
}
function Sumar(){
interval = setInterval("calcular()",1);
}
function calcular(){
uno = document.autoSumForm.valor.value;
dos = document.autoSumForm.comision.value;
document.autoSumForm.valortotal.value = (uno*1)+(dos*1);
}
function NoSumar(){
clearInterval(interval);
}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--
.Estilo1 {font-family: "Comic Sans MS"}
.Estilo2 {
font-weight: bold;
font-size: 16px;
}
.Estilo3 {
font-family: "Arial Black";
font-weight: bold;
font-size: 24px;
color: #FFF;
text-align: center;
}
body {
background-image: url(80.jpg);
}
.Estilo6 {font-family: "Comic Sans MS"; color: #000000; }
.Estilo7 {font-size: 16px}
.Estilo8 {
color: #FFFFFF;
text-align: center;
}
.style1 {font-size: 18px}
-->
<table width="100%" border="0"><tr><td width="85%" height="415"> <form id="formulario1" name="autoSumForm" method="POST" action="guardar_factura.php"> <table width="100%" border="0"> <td height="414" colspan="3"><div align="center" class="Estilo3"> <table width="100%" border="0"> <td> <div align="right" class="Estilo3"> <p><a href="desconectar.php">cerrar sesion
</a></p> <td><center><img src="INICIO.png" width="295" height="114"></center></td> <td width="15%" rowspan="2"><script type="text/javascript" src="index-files/sc14h1a.js"></script> <table id="vista-buttons.com:id14h1a" width=0 cellpadding=0 cellspacing=0 border=0> <td style="padding-bottom:11px" title ="FACTURACION"><a href="facturacion.php" onMouseDown='xpe("14h1ac");' onMouseOver='xpe("14h1ao");' onMouseOut='xpe("14h1an");'></a><a href="facturacion.php" onMouseDown='xpe("14h1ac");' onMouseOver='xpe("14h1ao");' onMouseOut='xpe("14h1an");'><img id="xpi_14h1a" src="index-files/bt14h1a_0.gif" name="vb14h1a" width="180" height="39" border="0" alt="FACTURACION"/></a></td> <td style="padding-bottom:11px" title ="VENTAS"><a onMouseOver='xpe("c4h1ao");' onMouseOut='xpe("c4h1an");' onMouseDown='xpe("c4h1ac");'><img id="xpi_c4h1a" src="index-files/btc4h1a_0.gif" name="vbc4h1a" width="180" height="39" border="0" alt="VENTAS"/></a></td> <td style="padding-bottom:11px" title ="INVENTARIOS"><a onMouseOver='xpe("d4h1ao");' onMouseOut='xpe("d4h1an");' onMouseDown='xpe("d4h1ac");'><img id="xpi_d4h1a" src="index-files/btd4h1a_0.gif" name="vbd4h1a" width="180" height="39" border="0" alt="INVENTARIOS"/></a></td> <td style="padding-bottom:11px" title ="PROVEDORES"><a onMouseOver='xpe("74h1ao");' onMouseOut='xpe("74h1an");' onMouseDown='xpe("74h1ac");'><img id="xpi_74h1a" src="index-files/bt74h1a_0.gif" name="vb74h1a" width="180" height="39" border="0" alt="PROVEDORES"/></a></td> <td width="85%" height="152"><table width="100%" border="0"> <td colspan="15"><div align="center" class="Estilo7 Estilo1 Estilo6 Estilo8 style1"><strong> FACTURACION SERVICIOS PUBLICOS
</strong></div></td> <td colspan="15"><span class="Estilo3">SELECCIONE CANTIDAD
</span> <select name="menu1" class="Estilo6" onChange="MM_jumpMenu('parent',this,0)"> <?
for($i=1;$i<=20;$i++)
{
if($_GET["Line"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$_SERVER["PHP_SELF"];?>?Line=
<?=$i;?>"
<?=$sel;?>>
<?=$i;?>
<?
}
?>
<td class="Estilo1"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td class="Estilo1"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td width="20%" class="Estilo1"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td width="15%" class="Estilo1"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td width="15%" class="Estilo1"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td width="19%"><div align="right" class="Estilo7 Estilo1 Estilo6 Estilo8"> <td width="5%"> </td> <?
$line = $_GET["Line"];
if($line == 0){$line=1;}
for($i=1;$i<=$line;$i++)
{
?>
<td width="15%" class="Estilo1"><center> <select name="empresa<?=$i;?>"class="estilo1" id="empresa">
<td width="11%" class="Estilo1"><div align="center"> <input name="codigo<?=$i;?>" type="text" id="codigo" value="" size="10" maxlength="10" />
<td class="Estilo1"><div align="center"> <input name="fecha<?=$i;?>" type="text" id="fecha" value="" size="20" maxlength="20" />
<td class="Estilo1"><div align="center"> <input type="text"id="valor" onFocus="Sumar();" onBlur="NoSumar();" name="valor<?=$i;?>" value="" size="15" maxlength="15">
<td class="Estilo1"><div align="center"> <input type="text" id="comision" onFocus="Sumar();" onBlur="NoSumar();" name="comision<?=$i;?>" value="" size="15" maxlength="15">
<td><div align="left" class="Estilo1"> <input type="text" class="Estilo6" id="valortotal" name="valortotal<?=$i;?>" size="15" maxlength="15" />
<?
}
?>
<td height="37" colspan="7" class="Estilo8">VALOR TOTAL:
<?PHP echo $_REQUEST['valortotal<?=$i;?>'] ?>
</td> <td class="Estilo1"> </td> <td height="37" class="Estilo1"> </td> <td height="37" class="Estilo1"><div align="center" class="Estilo1 Estilo2 Estilo1"> <input name="Submit" type="submit" class="Estilo1" id="guardar" value="guardar"/> <input type="hidden" name="hdnLine" value="<?=$i;?>">
les agradesco mucho de antemano


