Subaru Lease Calculator
.subaru-lease-calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 10px;
background-color: #f9f9f9;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.subaru-lease-calculator-container h2 {
color: #2c3e50;
text-align: center;
margin-bottom: 25px;
font-size: 1.8em;
}
.subaru-lease-calculator-container h3 {
color: #34495e;
margin-top: 30px;
margin-bottom: 15px;
font-size: 1.4em;
}
.subaru-lease-calculator-container h4 {
color: #34495e;
margin-top: 25px;
margin-bottom: 10px;
font-size: 1.2em;
}
.calculator-form .form-group {
display: flex;
flex-direction: column;
margin-bottom: 15px;
}
.calculator-form label {
margin-bottom: 8px;
font-weight: bold;
color: #555;
font-size: 0.95em;
}
.calculator-form input[type="number"] {
padding: 12px;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 1em;
width: 100%;
box-sizing: border-box;
transition: border-color 0.3s ease;
}
.calculator-form input[type="number"]:focus {
border-color: #007bff;
outline: none;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}
.calculator-form button {
background-color: #007bff;
color: white;
padding: 14px 25px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 1.1em;
font-weight: bold;
margin-top: 20px;
width: 100%;
box-sizing: border-box;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
transform: translateY(-2px);
}
.calculator-results {
margin-top: 30px;
padding: 20px;
background-color: #e9f7ef;
border: 1px solid #d4edda;
border-radius: 8px;
text-align: center;
}
.calculator-results h3 {
color: #28a745;
margin-top: 0;
font-size: 1.5em;
}
.result-output {
font-size: 2.2em;
font-weight: bold;
color: #28a745;
margin-top: 10px;
}
.calculator-article {
margin-top: 30px;
line-height: 1.6;
color: #333;
}
.calculator-article p {
margin-bottom: 1em;
}
.calculator-article ul {
list-style-type: disc;
margin-left: 20px;
margin-bottom: 1em;
}
.calculator-article ol {
list-style-type: decimal;
margin-left: 20px;
margin-bottom: 1em;
}
.calculator-article li {
margin-bottom: 0.5em;
}
function calculateSubaruLease() {
var msrp = parseFloat(document.getElementById('msrp').value);
var negotiatedPrice = parseFloat(document.getElementById('negotiatedPrice').value);
var residualValuePercent = parseFloat(document.getElementById('residualValuePercent').value);
var leaseTerm = parseFloat(document.getElementById('leaseTerm').value);
var moneyFactor = parseFloat(document.getElementById('moneyFactor').value);
var tradeInValue = parseFloat(document.getElementById('tradeInValue').value);
var downPayment = parseFloat(document.getElementById('downPayment').value);
var acquisitionFee = parseFloat(document.getElementById('acquisitionFee').value);
var documentationFee = parseFloat(document.getElementById('documentationFee').value);
var salesTaxRate = parseFloat(document.getElementById('salesTaxRate').value);
// Input validation
if (isNaN(msrp) || msrp <= 0) {
document.getElementById('result').innerHTML = "Please enter a valid Subaru MSRP.";
return;
}
if (isNaN(negotiatedPrice) || negotiatedPrice <= 0) {
document.getElementById('result').innerHTML = "Please enter a valid Negotiated Price.";
return;
}
if (isNaN(residualValuePercent) || residualValuePercent 100) {
document.getElementById('result').innerHTML = "Please enter a valid Residual Value Percentage (0-100).";
return;
}
if (isNaN(leaseTerm) || leaseTerm <= 0) {
document.getElementById('result').innerHTML = "Please enter a valid Lease Term in months.";
return;
}
if (isNaN(moneyFactor) || moneyFactor < 0) {
document.getElementById('result').innerHTML = "Please enter a valid Money Factor.";
return;
}
if (isNaN(tradeInValue) || tradeInValue < 0) {
document.getElementById('result').innerHTML = "Please enter a valid Trade-in Value (or 0).";
return;
}
if (isNaN(downPayment) || downPayment < 0) {
document.getElementById('result').innerHTML = "Please enter a valid Down Payment (or 0).";
return;
}
if (isNaN(acquisitionFee) || acquisitionFee < 0) {
document.getElementById('result').innerHTML = "Please enter a valid Acquisition Fee (or 0).";
return;
}
if (isNaN(documentationFee) || documentationFee < 0) {
document.getElementById('result').innerHTML = "Please enter a valid Documentation Fee (or 0).";
return;
}
if (isNaN(salesTaxRate) || salesTaxRate msrp) {
document.getElementById('result').innerHTML = "Negotiated Price cannot be higher than MSRP.";
return;
}
// Ensure trade-in and down payment don't exceed negotiated price
if (tradeInValue + downPayment > negotiatedPrice) {
document.getElementById('result').innerHTML = "Trade-in Value and Down Payment combined cannot exceed the Negotiated Price.";
return;
}
// 1. Calculate Residual Value (dollar amount)
var residualValue = msrp * (residualValuePercent / 100);
// 2. Calculate Adjusted Capitalized Cost
var adjustedCapitalizedCost = negotiatedPrice – tradeInValue – downPayment + acquisitionFee + documentationFee;
// 3. Calculate Depreciation Portion
var depreciationPortion = (adjustedCapitalizedCost – residualValue) / leaseTerm;
// 4. Calculate Finance Portion
var financePortion = (adjustedCapitalizedCost + residualValue) * moneyFactor;
// 5. Calculate Base Monthly Payment
var baseMonthlyPayment = depreciationPortion + financePortion;
// 6. Calculate Sales Tax Amount (assuming tax on monthly payment)
var salesTaxAmount = baseMonthlyPayment * (salesTaxRate / 100);
// 7. Calculate Total Monthly Payment
var totalMonthlyPayment = baseMonthlyPayment + salesTaxAmount;
document.getElementById('result').innerHTML = "$" + totalMonthlyPayment.toFixed(2);
}