I have been working on this calculator and with help and alot of reading I still have not figured this thing out. I am trying to make a basic ROI Calculator and it works the way it should but now the totals are not working

. From everything I have been reading I wonder if I should even use javascript or if I should use PHP. I know basic programming (I understand what I read) but don't really know that much. What I am trying to do is kind of similar to the idea of this ROI Calculator
http://www.ledareus.com/index.php?ro...formation_id=7. Can anyone help me with why my totals are not working? Do I need to make a totally different function for them? Here is the code I have been working with but just get stuck at the same exact spot with the totals not working.
function money( amt )
{
var n = amt.toFixed(0);
return n.replace(/(\d)(?=(\d{3})+\b)/g,'$1,');
}
function totalpower()
{
var f = document.form;
var v = new Object();
v.sum = f.c5.value * f.c6.value;
v.ledsum = f.e5.value * f.e6.value;
v.kwh = v.sum * f.c8.value * f.c9.value / 1000;
v.ledkwh = v.ledsum * f.e8.value * f.e9.value / 1000;
v.sum1 = v.kwh * f.c11.value;
v.ledsum1 = v.ledkwh * f.e11.value;
v.e15 = 100000;
v.lampyears = (f.c15.value / f.c9.value) / f.c8.value;
v.ledlampyears = (v.e15 / f.e9.value) / f.e8.value;
v.e17 = 0;
v.avgcost = f.c17.value / v.lampyears;
v.ledavgcost = v.e17 / v.ledlampyears;
v.totalmain = (v.avgcost + f.c19.value);
v.ledtotalmain = (v.ledavgcost + f.e19.value);
v.totalancost = v.sum1 - 2 + v.totalmain;
v.ledtotalancost = v.ledsum1 - 2 + v.ledtotalmain;
v.totalpurprice = f.c25.value * f.c5.value;
v.ledtotalpurprice = f.e25.value * f.e5.value;
for ( var val in v )
{
f[val].value = money( v[val] );
}
}