<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Created by: Jeremy Zongker: http://www.creditorweb.com/content/ -->
<!-- Begin
function cwCalc()
{
if (cwBalance.value=='') {alert('Please enter your loan amount.'); return;}
if (cwRate.value=='') {alert('Please enter your loan\'s interest rate.'); return;}
if ( (cwMonthlyAmount.value=='' && cwDesiredMonths.value=='') || (cwMonthlyAmount.value!='' && cwDesiredMonths.value!='') ) {alert('Please enter desired loan period in months .'); return;}
var mRate=(cwRate.value/100)/12;
if (cwMonthlyAmount.value=='')
{
	var payment=cwBalance.value<li>(mRate)/( 1-Math.pow((1+mRate),(-cwDesiredMonths.value)) );
	payment=Math.round(payment<li>100)/100;
	cwResult.innerHTML="Monthly payments will be £" + payment.toFixed(2) + " and the total repaid will be £" + (payment<li>cwDesiredMonths.value).toFixed(2) + ".";
} else {
	var remainingBalance=cwBalance.value;
	var minPayment=mRate<li>cwBalance.value;
	var months=0;
	var lastPayment;
	if (minPayment>cwMonthlyAmount.value) {alert ('Your monthly payment is less than the monthly interest charged.');return;}
	while (remainingBalance>0)
	{
		months++;
		remainingBalance=remainingBalance<li>(1 + mRate)-cwMonthlyAmount.value;
	}
	cwResult.innerHTML="It will take " + months + " months to pay off this card and will cost you a total of £" + (cwMonthlyAmount.value<li>months).toFixed(2) + ".";
}
}
//  End -->