//DO NOT REMOVE THIS COPYWRITE INFO!
//Future Value of Periodic Payments Calculator
//By Daniel C. Peterson
//Web Winder Website Services, 1997-2008  All Rights Reserved.
//Distribution, editing or reselling of this script is strictyly prohibited
//without expressed written permission from Daniel C. Peterson.
//For commercial grade (professional) versions of this and many other
//calculators, visit http://www.webwinder.com.

function computeForm(form)  {

    var i = form.interest.value;

    if (i > 1.0) {i = form.interest.value / 100} else {i = form.interest.value};

    i /= 12;

   var ma = eval(form.moAdd.value);

   var prin = eval(form.principal.value);

   var pmts = eval(form.payments.value * 12);

   var count = 0;
    
   while(count < pmts) {

        newprin = prin + ma;

        prin = (newprin * i) + eval(prin + ma);

        count = count + 1;

      }

    form.fv.value = prin;
		
		var totinv = eval(count * ma) + eval(form.principal.value);

    form.totalint.value = eval(prin - totinv);

}



function clearForm(form)

{

    form.payments.value = "";

    form.interest.value = "";

    form.principal.value = "";

    form.moAdd.value = "";

}