// Loans JavaScript
function CarLoanCalculator()
{
	//form = document.myform
	form = document.getElementById("myform");
	LoanAmount= form.LoanAmount.value
		
	DownPayment= "0"
	AnnualInterestRate = form.InterestRate.value/100
	Years= form.NumberOfYears.value
	MonthRate=AnnualInterestRate/12
	NumPayments=Years*12
	Prin=LoanAmount-DownPayment
	
	MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100
	form.NumberOfPayments.value=NumPayments
	form.MonthlyPayment.value=MonthPayment
}
var now = new Date();

var currentYear = now.getFullYear();
var currentMonth = now.getMonth();
var currentDate = now.getDate();

if(currentMonth == 0) {
	month = "01";
}
if(currentMonth == 1) {
	month = "02";
}
if(currentMonth == 2) {
	month = "03";
}
if(currentMonth == 3) {
	month = "04";
}
if(currentMonth == 4) {
	month = "05";
}
if(currentMonth == 5) {
	month = "06";
}
if(currentMonth == 6) {
	month = "07";
}
if(currentMonth == 7) {
	month = "08";
}
if(currentMonth == 8) {
	month = "09";
}
if(currentMonth == 9) {
	month = "10";
}
if(currentMonth == 10) {
	month = "11";
}
if(currentMonth == 11) {
	month ="12";
}

var mdydate = month + "/" + currentDate + "/" + currentYear;

document.write("<input type='hidden' name='date' value='");
document.write(mdydate);
document.write("'>");