// Main JavaScript file for shared functionality // Mobile menu toggle functionality document.addEventListener('DOMContentLoaded', function() { // Initialize Feather Icons feather.replace(); // 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'); }); } // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth' }); } }); }); // Form submission handling const contactForm = document.getElementById('contact-form'); if (contactForm) { contactForm.addEventListener('submit', function(e) { e.preventDefault(); // Here you would typically send the form data to your server // For demo purposes, we'll just show a success message const submitButton = contactForm.querySelector('button[type="submit"]'); const originalButtonText = submitButton.textContent; submitButton.disabled = true; submitButton.innerHTML = ' Sending...'; feather.replace(); // Simulate API call setTimeout(() => { submitButton.innerHTML = ' Message Sent!'; feather.replace(); // Reset form contactForm.reset(); // Reset button after 3 seconds setTimeout(() => { submitButton.disabled = false; submitButton.textContent = originalButtonText; feather.replace(); }, 3000); }, 1500); }); } }); // Function to handle service card clicks function navigateToService(serviceId) { window.location.href = `/services/${serviceId}`; } // Function to initialize Google Maps function initMap() { // This would be replaced with your actual Google Maps API implementation console.log('Map would be initialized here'); } // Call the map function when the window loads window.onload = function() { if (document.getElementById('map')) { initMap(); } };