// Main interactive functions for the website document.addEventListener('DOMContentLoaded', function() { // Mobile menu toggle const mobileMenuButton = document.getElementById('mobile-menu-button'); const mobileMenu = document.getElementById('mobile-menu'); if (mobileMenuButton && mobileMenu) { mobileMenuButton.addEventListener('click', function() { mobileMenu.classList.toggle('hidden'); }); } // Image gallery modal const galleryModal = document.getElementById('gallery-modal'); const modalImage = document.getElementById('modal-image'); const closeModal = document.getElementById('close-modal'); const galleryItems = document.querySelectorAll('.gallery-item'); if (galleryModal) { galleryItems.forEach(item => { item.addEventListener('click', function() { const imgSrc = this.querySelector('img').src; modalImage.src = imgSrc; galleryModal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; }); }); closeModal.addEventListener('click', function() { galleryModal.classList.add('hidden'); document.body.style.overflow = 'auto'; }); galleryModal.addEventListener('click', function(e) { if (e.target === galleryModal) { galleryModal.classList.add('hidden'); document.body.style.overflow = 'auto'; } }); } // Scroll to top button const scrollToTopBtn = document.getElementById('scroll-to-top'); if (scrollToTopBtn) { window.addEventListener('scroll', function() { if (window.pageYOffset > 300) { scrollToTopBtn.classList.remove('hidden'); } else { scrollToTopBtn.classList.add('hidden'); } }); scrollToTopBtn.addEventListener('click', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } }); // Form validation for contact form function validateForm() { const name = document.getElementById('name').value.trim(); const email = document.getElementById('email').value.trim(); const message = document.getElementById('message').value.trim(); if (name === '' || email === '' || message === '') { alert('Please fill in all fields'); return false; } if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) { alert('Please enter a valid email address'); return false; } return true; }