<!-- // Start of AdSubtract JavaScript block; you can ignore this.
     // It is used when AdSubtract blocks cookies or pop-up windows.
document.iMokie = "cookie blocked by AdSubtract";
document.iMferrer = "referrer blocked by AdSubtract";
function iMwin() {
	this.location = "";
	this.frames = new Array(9);
	this.frames[0] = this;
	this.frames[1] = this;
	this.frames[2] = this;
	this.frames[3] = this;
	this.frames[4] = this;
	this.frames[5] = this;
	this.frames[6] = this;
	this.frames[7] = this;
	this.frames[8] = this;
	this.length = 0;
}
// End of AdSubtract JavaScript block. -->
//<!--
//\include\motors\js\monthlypayment.js@@\main\5

function Pop(path,ficenter,price){if(ficenter!=""){path=path+"?ficenter=1";if(price!=""){path=path+"&price="+price;}
hw=new iMwin()                                                                                                                                      ;}else{path=path+"?ficenter=";if(price!=""){path=path+"&price="+price;}
hw=new iMwin()                                                                                                                                      ;}
hw.focus();return false;}
function roundAmount(n){var s=""+Math.round(n*100)/100
var i=s.indexOf('.')
if(i<0)return s+".00"
var t=s.substring(0,i+1)+s.substring(i+1,i+3)
if(i+2==s.length)t+="0"
return t}
function stripComma(target){if(null!=target)
{splitstring=target.split(",");if(null!=splitstring)
{target=splitstring[0];for(j=1;j<splitstring.length;j++)
{target+=splitstring[j];}}}
return target;}
function stripNonNumeric(pPrice)
{var tmp="",chr;for(var i=0;i<pPrice.length;i++)
{chr=pPrice.charAt(i);if((chr=='.')||!isNaN(parseInt(chr)))
tmp+=chr;}
return tmp;}
function MonthlyPaymentCalc(){price=document.MonthlyPayment.price.value;price=stripComma(price);APR=stripNonNumeric(document.MonthlyPayment.APR.value);payment=document.MonthlyPayment.payment.value;payment=stripComma(payment);for(var i=0;i<document.MonthlyPayment.months.length;i++){if(document.MonthlyPayment.months[i].selected==true){months=document.MonthlyPayment.months[i].value;}}
if(price.indexOf(".")!=-1){alert("Decimals should not be entered in the total price box");return false;}else if(payment.indexOf(".")!=-1){alert("Decimals should not be entered in the down payment box");return false;}else{RemainingPayment=price-payment;if(RemainingPayment>0){EstMonthlyPayment=(RemainingPayment+((RemainingPayment*APR)/100))/months;EstMonthlyPayment=roundAmount(EstMonthlyPayment);}else{EstMonthlyPayment="0.00";}
document.MonthlyPayment.EstMonthlyPayment.value=EstMonthlyPayment;return false;}}
// -->
