﻿function CarLoanCalculator()
{
	form = document.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
}

function OutTheDoor()
{
  SellingPrice = frmOTD.txtSellingPrice.value
  ACV = frmOTD.txtACV.value
  PayOff = frmOTD.txtPayOff.value
  TaxRate = frmOTD.txtTaxRate.value
  DocFee = 250
  Tax = ((SellingPrice - ACV) + (DocFee*1)) * TaxRate
  TotalPrice = ((((SellingPrice - ACV) + (DocFee*1)) + (PayOff*1)) + (Tax*1))
  
  frmOTD.txtTotalPrice.value = "$" + TotalPrice.toFixed(2);
  frmOTD.lblOTDPrice.value = 'Your "Out The Door" Price!'
}


