Contact Us

Get in Touch

We'd love to hear from you! Please use the form below or contact us directly.

Address

123 Main Street
Philadelphia, PA 19106

Phone

(123) 456-7890

Email

info@bhbc.com

Send us a Message

// Initialize Google Maps with proper error handling function initializeMap() { try { const mapElement = document.getElementById('map'); if (!mapElement) return; const mapOptions = { center: { lat: 32.8328, lng: -117.2713 }, // Solana Beach coordinates zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP }; const map = new google.maps.Map(mapElement, mapOptions); // Add marker const marker = new google.maps.Marker({ position: { lat: 32.8328, lng: -117.2713 }, map: map, title: 'BHBC Office' }); // Initialize search box with error handling const searchInput = document.getElementById('search-input'); if (searchInput) { const searchBox = new google.maps.places.SearchBox(searchInput); map.addListener('bounds_changed', () => { searchBox.setBounds(map.getBounds()); }); searchBox.addListener('places_changed', () => { const places = searchBox.getPlaces(); if (places.length === 0) return; const bounds = new google.maps.LatLngBounds(); places.forEach(place => { if (!place.geometry || !place.geometry.location) return; if (place.geometry.viewport) { bounds.union(place.geometry.viewport); } else { bounds.extend(place.geometry.location); } }); map.fitBounds(bounds); }); } return map; } catch (error) { console.error('Error initializing Google Maps:', error); const mapElement = document.getElementById('map'); if (mapElement) { mapElement.innerHTML = '
Unable to load map. Please try again later.
'; } return null; } } // Load Google Maps API with proper error handling function loadGoogleMapsAPI() { const script = document.createElement('script'); script.src = `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places&callback=initializeMap`; script.async = true; script.defer = true; script.onerror = () => { console.error('Failed to load Google Maps API'); const mapElement = document.getElementById('map'); if (mapElement) { mapElement.innerHTML = '
Failed to load map. Please try again later.
'; } }; document.head.appendChild(script); } // Call loadGoogleMapsAPI when the page loads window.addEventListener('load', loadGoogleMapsAPI);