Cold Climate Heat Pump Calculator
Step 2: Select Your Heating Source
Step 3: How Old is Your Heating System?
const heatingData = {
"naturalGas": { cost: 1.23, usage: 600 },
"propane": { cost: 3.39, usage: 800 },
"oil": { cost: 3.00, usage: 550 },
"electric": { cost: 0.22, usage: 10000 },
"none": { cost: 0, usage: 0 }
};
let zipCode, heatingSource, systemAge;
function nextStep(currentStep) {
if (currentStep === 1) {
zipCode = document.getElementById('zipCode').value.trim();
if (!/^\d{5}$/.test(zipCode)) {
alert("Please enter a valid 5-digit ZIP code.");
return;
}
const state = zipCode.startsWith("1") ? "NY" : zipCode.startsWith("0") ? "VT" : "other";
if (state === "other") {
alert("We do not cover your area.");
return;
}
const zoneInfo = climateZones[state];
document.getElementById('climateInfo').innerHTML = `
Climate Zone: ${zoneInfo.zone} (${zoneInfo.title})
Average Temp: ${zoneInfo.avg}°F (Min: ${zoneInfo.min}°F, Max: ${zoneInfo.max}°F)
`;
} else if (currentStep === 2) {
heatingSource = document.getElementById('heatingSource').value;
if (!heatingSource) {
alert("Please select your heating source.");
return;
}
}
document.getElementById(`step${currentStep}`).classList.add('hidden');
document.getElementById(`step${currentStep + 1}`).classList.remove('hidden');
}
function calculateResults() {
systemAge = document.getElementById('systemAge').value;
if (!systemAge) {
alert("Please select the age of your heating system.");
return;
}
const heating = heatingData[heatingSource];
const heatPump = { cost: 0.18, usage: heating.usage * 0.8 };
document.getElementById('heatingInfo').innerHTML = `
Your Current System:
Fuel Type: ${heatingSource}
Annual Usage: ${heating.usage} units
Annual Cost: $${(heating.cost * heating.usage).toFixed(2)}
`;
document.getElementById('heatPumpComparison').innerHTML = `
Heat Pump Comparison:
Estimated Annual Usage: ${heatPump.usage.toFixed(2)} kWh
Estimated Annual Cost: $${(heatPump.cost * heatPump.usage).toFixed(2)}
`;
document.getElementById('step3').classList.add('hidden');
document.getElementById('results').classList.remove('hidden');
}