document.addEventListener('DOMContentLoaded', function() { // Language selector functionality const languageSelector = document.getElementById('language-selector'); if (languageSelector) { languageSelector.addEventListener('change', function() { const form = document.createElement('form'); form.method = 'POST'; form.style.display = 'none'; const input = document.createElement('input'); input.type = 'hidden'; input.name = 'language'; input.value = this.value; form.appendChild(input); document.body.appendChild(form); form.submit(); }); } // Intersection Observer for animations const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add('slide-in'); } }); }, { threshold: 0.1 } ); document.querySelectorAll('.animate-on-scroll').forEach((el) => { observer.observe(el); }); // Smooth scroll for anchor 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' }); } }); }); });