this.width=300;
this.height=150;

function CalculateIt(LoanAmount, InterestRate,Years) {

	MonthlyInterestRate = (InterestRate / 100) /12;
	var Multiplier = 1 + MonthlyInterestRate;
	var TermRate = 1;
	for (var x=0;x<(Years*12);x++) {
		TermRate = TermRate * Multiplier;
	}
	var PrincipalInterest = (LoanAmount * MonthlyInterestRate) / (1 - (1/TermRate));
	PrincipalInterest = Math.floor(PrincipalInterest * 100) / 100;
	return PrincipalInterest;
}

function CheckBefore() {
	if (document.Calc.LoanAmount.value > 0)
		if (document.Calc.InterestRate.value >0) {
			document.Calc.year15.value=CalculateIt(document.Calc.LoanAmount.value, document.Calc.InterestRate.value, 15);
			document.Calc.year20.value=CalculateIt(document.Calc.LoanAmount.value, document.Calc.InterestRate.value, 20);
			document.Calc.year25.value=CalculateIt(document.Calc.LoanAmount.value, document.Calc.InterestRate.value, 25);
			document.Calc.year30.value=CalculateIt(document.Calc.LoanAmount.value, document.Calc.InterestRate.value, 30);
		}
}

