// Visa Pathfinder GPT Page JavaScript let formSubmitted = false; // Handle form submission function handleFormSubmit(event) { event.preventDefault(); if (formSubmitted) return; formSubmitted = true; const form = document.getElementById('visa-pathfinder-form'); const submitBtn = document.getElementById('submit-btn'); if (!form || !submitBtn) return; // Disable button to prevent double submission submitBtn.disabled = true; submitBtn.innerHTML = 'Opening GPT...'; // Submit form to Kit in hidden iframe form.submit(); // Open GPT in new tab immediately window.open('https://chatgpt.com/g/g-6893dcb75fec8191b93867579ab19410-visa-pathfinder', '_blank'); // Show success message setTimeout(() => { const formContainer = form.parentElement; if (formContainer) { formContainer.innerHTML = `

Success! 🎉

Your access has been granted!

The Visa Pathfinder GPT should now be open in a new tab.

Next Steps:
1. Check your new tab for the Visa Pathfinder GPT
2. Start by telling it your passport country and destination
3. Get personalized visa requirements and advice

Open Visa Pathfinder GPT Again

Having trouble? Check that popup blockers are disabled.

`; } }, 1000); } // Initialize the page function init() { console.log('Visa Pathfinder page initialized'); // Add form submit handler const form = document.getElementById('visa-pathfinder-form'); if (form) { form.addEventListener('submit', handleFormSubmit); } // Add smooth scrolling for internal links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); } // Cleanup function function teardown() { const form = document.getElementById('visa-pathfinder-form'); if (form) { form.removeEventListener('submit', handleFormSubmit); } formSubmitted = false; } // Export the required functions export { init, teardown };