function calculate(form){var m=form.pay.value,n=form.pay.value/2,g=form.prin.value,f=form.prin.value,l=0,k=0,j=0,i=0,a=0,d=0,c=0,e=0,o=form.rate.value;if(o>1.0){o=o/100.0;form.rate.value=o;};var q=o/12,p=o/26,b=0,h=0;while(g>0){l=g*q;j=m-l;g=g-j;d=d+j;a=a+l;b=b+1;if(b>600){break;}else{continue;};};if(b>600){alert("Using your entered terms you will never pay off this amount.  Please either lower the principal amount, lower the interest rate, or increase the payment amount.;");form.oldinterest.value="";form.newinterest.value="";form.savings.value="";form.para.value="";}else{form.oldinterest.value="$"+parseInt(a,10);while(f>0){k=f*p;i=n-k;f=f-i;e=e+i;c=c+k;h=h+1;if(b>600){break;}else{continue;};};form.newinterest.value="$"+parseInt(c,10);form.savings.value="$"+parseInt(a-c,10);form.para.value="Paying bi-weekly means you will be adding a 13th monthly payment each year. You will be adding an additional $"+parseInt(m/26,10)+" every two weeks. This will pay off your mortgage in "+parseInt(h/26*12,10)+" months instead of  "+b+" months. You will save $"+parseInt(a-c)+" in interest over the course of your loan.";};};function clearForm(form){form.prin.value="";form.pay.value="";form.rate.value="";form.savings.value="";form.oldinterest.value="";form.newinterest.value="";form.para.value="";};
