Note: This estimation is based on the HPI values provided by the user.
Generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}
`;
const printWindow = window.open('', '_blank');
if (printWindow) {
printWindow.document.write('
Home Price Index Tracker Report');
printWindow.document.write(pdfContent);
printWindow.document.write('');
printWindow.document.close();
printWindow.focus();
setTimeout(() => { printWindow.print(); }, 250);
} else {
alert('Could not open print window. Please check your browser pop-up settings.');
}
});
[originalPriceInput, hpiAtPurchaseInput, currentHpiInput].forEach(inputEl => {
if (inputEl) {
inputEl.addEventListener('focus', function() {
const errorElId = `hpit${this.id.substring(4)}Error`; // e.g. hpitOriginalPriceError
const errorDisplay = document.getElementById(errorElId);
if (errorDisplay) errorDisplay.textContent = '';
});
}
});
});