// Domain popup functionality function hideDomainPopup() { const popup = document.getElementById('domain-popup'); if (popup) { popup.style.opacity = '0'; popup.style.transform = 'scale(0.95)'; setTimeout(() => { popup.style.display = 'none'; }, 300); } } function handleInquireNow() { // Open email to contact@channeltrak.com with inquiry subject const subject = 'Inquiry about SolarTrainingNetwork.com Domain Purchase'; const body = 'Hi,%0D%0A%0D%0AI am interested in purchasing the SolarTrainingNetwork.com domain and website. Please provide more information about the pricing and purchase process.%0D%0A%0D%0AThank you!'; window.open(`mailto:contact@channeltrak.com?subject=${subject}&body=${body}`, '_blank'); hideDomainPopup(); } function handleLearnMore() { // Redirect to the sale-details page window.location.href = '/sale-details'; } function handleNotInterested() { console.log('User clicked Not Interested'); hideDomainPopup(); } function handleClosePopup() { hideDomainPopup(); } function handleEscapeKey(event) { if (event.key === 'Escape') { hideDomainPopup(); } } export function init() { // Show the popup immediately when page loads const popup = document.getElementById('domain-popup'); if (popup) { popup.style.display = 'flex'; popup.style.opacity = '1'; popup.style.transform = 'scale(1)'; } // Add event listeners to buttons const inquireBtn = document.getElementById('inquire-btn'); const learnMoreBtn = document.getElementById('learn-more-btn'); const notInterestedBtn = document.getElementById('not-interested-btn'); const closeBtn = document.getElementById('close-popup-btn'); if (inquireBtn) { inquireBtn.addEventListener('click', handleInquireNow); } if (learnMoreBtn) { learnMoreBtn.addEventListener('click', handleLearnMore); } if (notInterestedBtn) { notInterestedBtn.addEventListener('click', handleNotInterested); } if (closeBtn) { closeBtn.addEventListener('click', handleClosePopup); } // Add escape key listener document.addEventListener('keydown', handleEscapeKey); } export function teardown() { // Remove event listeners const inquireBtn = document.getElementById('inquire-btn'); const learnMoreBtn = document.getElementById('learn-more-btn'); const notInterestedBtn = document.getElementById('not-interested-btn'); const closeBtn = document.getElementById('close-popup-btn'); if (inquireBtn) { inquireBtn.removeEventListener('click', handleInquireNow); } if (learnMoreBtn) { learnMoreBtn.removeEventListener('click', handleLearnMore); } if (notInterestedBtn) { notInterestedBtn.removeEventListener('click', handleNotInterested); } if (closeBtn) { closeBtn.removeEventListener('click', handleClosePopup); } // Remove escape key listener document.removeEventListener('keydown', handleEscapeKey); }