function initCalloutbutton() { var calloutBtnDiv = document.getElementById('calloutButton'); map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(calloutBtnDiv) calloutBtnDiv.title = 'Click to toggle Callout Overlay'; // Setup the click event listeners to toggle icon display calloutBtnDiv.addEventListener('click', function() { callout_showing = !callout_showing; // Determine which button image to show if (callout_showing) { pic = "images/btnDepressed_Callout.png" // It's nice when icons become visible that the messages have been refreshed. showCalloutLayer(); } else { pic = "images/btnReady_Callout.png" hideCalloutLayer(); } document.getElementById('calloutBtnImg').src = pic; }); // Define the LatLng coordinates for the polygon's path. var triangleCoords = [{ lat: 33.84817790215087, lng: -117.9979705810547 }, { lat: 33.80482636349161, lng: -118.02680969238283 }, { lat: 33.80482636349161, lng: -117.97531127929689 }, { lat: 33.84817790215087, lng: -117.9979705810547 } ]; // Construct the polygon. region22 = new google.maps.Polygon({ paths: triangleCoords, strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35 }); } var region22; function showCalloutLayer() { region22.setMap(map); } function hideCalloutLayer() { region22.setMap(null); }