// JavaScript Finance Calculator

function Calculate_OnMouseOut()
{
document.form.Tfin.value = document.form.bcost.value - document.form.deposit.value;
}
function Calculate_ONCLICK()
{
var s = Math.pow(1+10/100,1/12);<!-- where the number 10 is the apr -->
	document.form.Tfin.value = document.form.bcost.value - document.form.deposit.value;
	document.form.r1.value= Math.round((document.form.Tfin.value) * (Math.pow(s,24))*(1-s)/(1-Math.pow(s,24)));
	document.form.r2.value= Math.round((document.form.Tfin.value) * (Math.pow(s,36))*(1-s)/(1-Math.pow(s,36)));
	document.form.r3.value= Math.round((document.form.Tfin.value) * (Math.pow(s,48))*(1-s)/(1-Math.pow(s,48)));
	document.form.r4.value= Math.round((document.form.Tfin.value) * (Math.pow(s,60))*(1-s)/(1-Math.pow(s,60)));
	<!-- s(~1.1) is the monthly multiplier which will be altered depending on the -->
	<!--apr the numbers 24,36,48,60 are the number of months the loan is over.-->
}

function Clear_ONCLICK()
{

	document.form.bcost.value = "";
	document.form.deposit.value= "0";
	document.form.Tfin.value= "0";
	document.form.r1.value = "0";
	document.form.r2.value = "0";
	document.form.r3.value = "0";
	document.form.r4.value = "0";
	document.form.bcost.focus();

}


function Window_Onload()
{

	document.form.bcost.focus();

}