Demand Letter Generator

Create your letter with state-specific citations

State
Situation
California Law Summary
Loading state-specific information...
Your Information
Recipient Information
Claim Details
Demand Terms
Include principal + interest + penalties if applicable
Recommended: Check state requirements
Live Preview
Updating...
`); printWindow.document.close(); printWindow.focus(); setTimeout(() => { printWindow.print(); printWindow.close(); }, 250); } function downloadDOCX() { // For now, create a simple HTML download that Word can open const preview = document.getElementById('documentPreview'); const htmlContent = ` ${preview.innerHTML} `; const blob = new Blob([htmlContent], { type: 'application/msword' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'demand-letter.doc'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showToast('Letter downloaded! Open with Microsoft Word.', 'success'); } // ======================================== // TOAST NOTIFICATION // ======================================== function showToast(message, type = '') { const toast = document.getElementById('toast'); toast.textContent = message; toast.className = 'toast ' + type; toast.classList.add('visible'); setTimeout(() => { toast.classList.remove('visible'); }, 3000); } // ======================================== // INITIALIZATION // ======================================== document.addEventListener('DOMContentLoaded', function() { // Check for URL parameters (for iframe/modal embedding) const urlParams = new URLSearchParams(window.location.search); const presetState = urlParams.get('state'); const presetSituation = urlParams.get('situation'); // Set state if provided, default to california if (presetState && StateModules[presetState]) { document.getElementById('stateSelect').value = presetState; } else { document.getElementById('stateSelect').value = 'california'; } // Set situation if provided, default to unpaid-wages for standalone if (presetSituation && SituationModules[presetSituation]) { document.getElementById('situationSelect').value = presetSituation; } else if (!presetSituation) { document.getElementById('situationSelect').value = 'unpaid-wages'; } // Load modules loadStateModule(); loadSituationModule(); });