// Shared JavaScript across all pages document.addEventListener('DOMContentLoaded', () => { // Handle support form submission const supportForm = document.getElementById('supportForm'); if (supportForm) { supportForm.addEventListener('submit', function(e) { e.preventDefault(); const formData = { name: document.getElementById('name').value, email: document.getElementById('email').value, phone: document.getElementById('phone').value, message: document.getElementById('message').value, urgent: document.getElementById('urgent').checked }; // In a real implementation, you would send formData to your backend console.log('Support request submitted:', formData); // Show success message const successMsg = document.getElementById('formSuccess'); if (successMsg) { successMsg.classList.remove('hidden'); supportForm.reset(); successMsg.scrollIntoView({ behavior: 'smooth' }); // Hide after 5 seconds setTimeout(() => { successMsg.classList.add('hidden'); }, 5000); } }); } // Load Google Translate iframe styles const loadTranslateStyles = () => { const iframe = document.querySelector('.goog-te-menu-frame'); if (!iframe) return; const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; const style = iframeDoc.createElement('style'); style.textContent = ` .goog-te-menu2 { font-family: 'Montserrat', sans-serif !important; background-color: #111827 !important; border: 1px solid #e3b341 !important; } .goog-te-menu2-item div, .goog-te-menu2-item-selected div { color: white !important; padding: 8px 16px !important; } .goog-te-menu2-item-selected { background-color: rgba(227, 179, 65, 0.2) !important; } .goog-te-menu2-item:hover { background-color: rgba(227, 179, 65, 0.1) !important; } `; iframeDoc.head.appendChild(style); }; // Check for Google Translate iframe periodically const translateInterval = setInterval(() => { if (document.querySelector('.goog-te-menu-frame')) { loadTranslateStyles(); clearInterval(translateInterval); } }, 100); // Create twinkling stars const starsCount = 200; for (let i = 0; i < starsCount; i++) { const star = document.createElement('div'); star.className = 'star'; star.style.width = `${Math.random() * 3 + 1}px`; star.style.height = star.style.width; star.style.left = `${Math.random() * 100}%`; star.style.top = `${Math.random() * 100}%`; star.style.animationDelay = `${Math.random() * 3}s`; document.body.appendChild(star); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); });