Housing Cost Optimization Planner

Your Current Housing Cost Snapshot

Renting Details

$
$

Rent vs. Buy Comparison

Renting Scenario

$
$

Buying Scenario

$
%
%
$
$
$
%
%
%

Mortgage Optimization Tools

Refinance Calculator

Is Refinancing Right for You?

$
%
%
$
Extra Payments Calculator

Pay Off Your Mortgage Faster!

$
%
$
Down Payment Impact Analyzer

See How Your Down Payment Changes Things

$
%
%
%

Housing Affordability Estimator

Estimate what you might comfortably afford based on common guidelines. These are estimates only.

$
$
%
%

For Home Price Estimation (Optional Advanced):

%
%
%

Download Report

Generate a PDF summary of your housing cost analyses and scenarios.

Renter's Insurance: $${getNum(currentRentersInsuranceEl).toFixed(2)}

`; } else { pdfHtml += `

P&I: $${getNum(currentPandIEl).toFixed(2)}

`; pdfHtml += `

Property Taxes: $${getNum(currentPropertyTaxesEl).toFixed(2)}

`; pdfHtml += `

Home Insurance: $${getNum(currentHomeInsuranceEl).toFixed(2)}

`; pdfHtml += `

HOA: $${getNum(currentHOAEl).toFixed(2)}

`; pdfHtml += `

PMI: $${getNum(currentPMIEl).toFixed(2)}

`; pdfHtml += `

Maintenance: $${getNum(currentMaintenanceEl).toFixed(2)}

`; } pdfHtml += `
`; pdfHtml += `
${currentCostsResultsEl.innerHTML}
`; } // Section 2: Rent vs. Buy if (rentVsBuyResultsEl && rentVsBuyResultsEl.style.display !== 'none' && rentVsBuyResultsEl.innerHTML.length > 20) { pdfHtml += `

Rent vs. Buy Analyzer

`; // Add inputs... pdfHtml += `

Inputs:

Rent: $${getNum(rvbRentEl).toFixed(2)}, Renters Ins: $${getNum(rvbRentersInsEl).toFixed(2)}

Home Price: $${getNum(rvbHomePriceEl).toFixed(2)}, DP: ${getNum(rvbDownPaymentPercentEl)}%, Rate: ${getNum(rvbInterestRateEl)}%, Term: ${getVal(rvbLoanTermEl)} yrs

Taxes: $${getNum(rvbPropertyTaxEl).toFixed(2)}/yr, Home Ins: $${getNum(rvbHomeInsEl).toFixed(2)}/yr, HOA: $${getNum(rvbHOAEl).toFixed(2)}/mo

PMI Rate: ${getNum(rvbPMIRateEl)}%/yr, Maintenance: ${getNum(rvbMaintenanceEl)}%/yr, Closing: ${getNum(rvbClosingCostsEl)}%

`; pdfHtml += `
${rentVsBuyResultsEl.innerHTML}
`; } // Section 3: Mortgage Optimizer (Refinance, Extra Payments, Down Payment) if (refinanceResultsEl && refinanceResultsEl.style.display !== 'none' && refinanceResultsEl.innerHTML.length > 20) { pdfHtml += `

Refinance Analysis

`; pdfHtml += `

Inputs:

Current Balance: $${getNum(refiCurrentBalanceEl).toFixed(2)}, Rate: ${getNum(refiCurrentRateEl)}%, Term: ${getNum(refiRemainingTermEl)} yrs

New Rate: ${getNum(refiNewRateEl)}%, New Term: ${getNum(refiNewTermEl)} yrs, Costs: $${getNum(refiCostsEl).toFixed(2)}

`; pdfHtml += `
${refinanceResultsEl.innerHTML}
`; } if (extraPaymentsResultsEl && extraPaymentsResultsEl.style.display !== 'none' && extraPaymentsResultsEl.innerHTML.length > 20) { pdfHtml += `

Extra Payments Analysis

`; pdfHtml += `

Inputs:

Balance: $${getNum(epLoanBalanceEl).toFixed(2)}, Rate: ${getNum(epInterestRateEl)}%, Term: ${getNum(epRemainingTermEl)} yrs, Extra: $${getNum(epExtraPaymentEl).toFixed(2)}/mo

`; pdfHtml += `
${extraPaymentsResultsEl.innerHTML}
`; } if (downPaymentResultsEl && downPaymentResultsEl.style.display !== 'none' && downPaymentResultsEl.innerHTML.length > 20) { pdfHtml += `

Down Payment Impact

`; pdfHtml += `

Inputs:

Home Price: $${getNum(dpHomePriceEl).toFixed(2)}, Rate: ${getNum(dpInterestRateEl)}%, Term: ${getVal(dpLoanTermEl)} yrs, DP: ${getNum(dpDownPaymentPercentEl)}%

`; pdfHtml += `
${downPaymentResultsEl.innerHTML}
`; } // Section 4: Affordability if (affordabilityResultsEl && affordabilityResultsEl.style.display !== 'none' && affordabilityResultsEl.innerHTML.length > 20) { pdfHtml += `

Housing Affordability Estimation

`; pdfHtml += `

Inputs:

Income: $${getNum(affordGrossIncomeEl).toFixed(2)}/yr, Monthly Debts: $${getNum(affordMonthlyDebtsEl).toFixed(2)}

Housing Ratio: ${getNum(affordHousingRatioEl)}%, DTI Ratio: ${getNum(affordDTIRatioEl)}%

`; pdfHtml += `
${affordabilityResultsEl.innerHTML}
`; } pdfHtml += `
`; // Close hcot-pdf-output pdfOutputEl.innerHTML = pdfHtml; const opt = { margin: [0.5, 0.4, 0.5, 0.4], filename: `Housing_Cost_Optimization_Report_${new Date().toISOString().slice(0,10)}.pdf`, image: { type: 'jpeg', quality: 0.95 }, html2canvas: { scale: 2, useCORS: true, logging: false, scrollX: 0, scrollY: 0, windowWidth: pdfOutputEl.scrollWidth, windowHeight: pdfOutputEl.scrollHeight + 50}, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }, pagebreak: { mode: ['css', 'avoid-all', 'legacy'] } // 'css' or 'avoid-all' can be good }; if (html2pdf && pdfOutputEl) { html2pdf().from(pdfOutputEl).set(opt).save() .catch(err => { console.error("PDF generation failed:", err); alert("PDF generation failed. See console for details."); }); } else { alert("PDF generation library or output element not ready."); } }); } // --- Tab Navigation --- window.hcot_openTab = function(evt, tabName) { tabs.forEach(tab => { if(tab) tab.style.display = 'none'; }); tabLinks.forEach(link => { if(link) link.classList.remove('active'); }); const activeTabContent = toolContainer.querySelector('#' + tabName); if(activeTabContent) activeTabContent.style.display = 'block'; else { console.error(`Tab content for ${tabName} not found.`); return; } let clickedIndex = -1; if (evt && evt.currentTarget) { evt.currentTarget.classList.add('active'); clickedIndex = tabLinks.indexOf(evt.currentTarget); } else { clickedIndex = tabLinks.findIndex(link => { const onclickAttr = link.getAttribute('onclick'); return onclickAttr && onclickAttr.includes(tabName); }); if (clickedIndex !== -1 && tabLinks[clickedIndex]) tabLinks[clickedIndex].classList.add('active'); } currentTabIndex = clickedIndex !== -1 ? clickedIndex : 0; hcot_updateNavButtons(); } window.hcot_navigateTab = function(direction) { let newIndex = currentTabIndex; if (direction === 'next' && currentTabIndex < tabs.length - 1) newIndex++; else if (direction === 'prev' && currentTabIndex > 0) newIndex--; if (tabLinks[newIndex] && newIndex !== currentTabIndex) tabLinks[newIndex].click(); } function hcot_updateNavButtons() { if(prevButton) prevButton.disabled = currentTabIndex === 0; if(nextButton) nextButton.disabled = currentTabIndex >= tabs.length - 1; } // --- Initialization --- function initializeTool() { // Check for Font Awesome (if icons are desired and not globally available) // if (typeof FontAwesome === 'undefined') { /* Potentially load FA or inform user */ } // Default values if elements exist if(currentSituationRentingEl) currentSituationRentingEl.checked = true; hcot_toggleCurrentSituationForms(); // Set initial form visibility const today = new Date(); // Not used here but good practice if date inputs needed default hcot_openTab(null, 'hcot-tab1'); // Open first tab } // Check if html2pdf is loaded (it's from CDN) let attempts = 0; function checkLibrariesAndInit_hcot() { if (typeof html2pdf !== 'undefined') { initializeTool(); } else if (attempts < 20) { // Try for 2 seconds attempts++; setTimeout(checkLibrariesAndInit_hcot, 100); } else { alert("Error: PDF generation library (html2pdf.js) could not be loaded. PDF export will not work."); initializeTool(); // Initialize anyway } } checkLibrariesAndInit_hcot(); })();
Scroll to Top