function initCCTVbutton() { var cctvBtnDiv = document.getElementById('cctvButton'); map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(cctvBtnDiv) cctvBtnDiv.title = 'Click to toggle cctv view'; // Setup the click event listeners to toggle icon display cctvBtnDiv.addEventListener('click', function() { cctv_showing = !cctv_showing; // reveal or hide all the icons cctvLayer.forEach(function(feature) { cctvLayer.overrideStyle(feature, { visible: cctv_showing }); }); // Determine which button image to show if (cctv_showing) { pic = "images/btnDepressed_CCTV.png" } else { pic = "images/btnReady_CCTV.png" } document.getElementById('cctvBtnImg').src = pic; }); } function makecctvIcon(nearVDS) { var imgIcon = cctvIcon if ((typeof map.data.getFeatureById(nearVDS)) == "undefined") { imgIcon = cctvIconWhite; } return imgIcon } function loadCCTVlayer() { var imgTag = '' + cctvIndex + " " + cctvLocation + " " + '