// JavaScript Document //////// markerwithlabel /** * google-maps-utility-library-v3-markerwithlabel * * @version: 1.1.10 * @author: Gary Little (inspired by code from Marc Ridey of Google). * @contributors: Nicholas McCready * @date: Fri May 13 2016 16:29:58 GMT-0400 (EDT) * @license: Apache License 2.0 */ function inherits(e,t){function i(){}i.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new i,e.prototype.constructor=e}function MarkerLabel_(e,t,i){this.marker_=e,this.handCursorURL_=e.handCursorURL,this.labelDiv_=document.createElement("div"),this.labelDiv_.style.cssText="position: absolute; overflow: hidden;",this.eventDiv_=document.createElement("div"),this.eventDiv_.style.cssText=this.labelDiv_.style.cssText,this.eventDiv_.setAttribute("onselectstart","return false;"),this.eventDiv_.setAttribute("ondragstart","return false;"),this.crossDiv_=MarkerLabel_.getSharedCross(t)}function MarkerWithLabel(e){e=e||{},e.labelContent=e.labelContent||"",e.labelAnchor=e.labelAnchor||new google.maps.Point(0,0),e.labelClass=e.labelClass||"markerLabels",e.labelStyle=e.labelStyle||{},e.labelInBackground=e.labelInBackground||!1,"undefined"==typeof e.labelVisible&&(e.labelVisible=!0),"undefined"==typeof e.raiseOnDrag&&(e.raiseOnDrag=!0),"undefined"==typeof e.clickable&&(e.clickable=!0),"undefined"==typeof e.draggable&&(e.draggable=!1),"undefined"==typeof e.optimized&&(e.optimized=!1),e.crossImage=e.crossImage||"http"+("https:"===document.location.protocol?"s":"")+"://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png",e.handCursor=e.handCursor||"http"+("https:"===document.location.protocol?"s":"")+"://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur",e.optimized=!1,this.label=new MarkerLabel_(this,e.crossImage,e.handCursor),google.maps.Marker.apply(this,arguments)}inherits(MarkerLabel_,google.maps.OverlayView),MarkerLabel_.getSharedCross=function(e){var t;return"undefined"==typeof MarkerLabel_.getSharedCross.crossDiv&&(t=document.createElement("img"),t.style.cssText="position: absolute; z-index: 1000002; display: none;",t.style.marginLeft="-8px",t.style.marginTop="-9px",t.src=e,MarkerLabel_.getSharedCross.crossDiv=t),MarkerLabel_.getSharedCross.crossDiv},MarkerLabel_.prototype.onAdd=function(){var e,t,i,s,a,r,o,n=this,l=!1,g=!1,p=20,_="url("+this.handCursorURL_+")",h=function(e){e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()},v=function(){n.marker_.setAnimation(null)};this.getPanes().overlayImage.appendChild(this.labelDiv_),this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_),"undefined"==typeof MarkerLabel_.getSharedCross.processed&&(this.getPanes().overlayImage.appendChild(this.crossDiv_),MarkerLabel_.getSharedCross.processed=!0),this.listeners_=[google.maps.event.addDomListener(this.eventDiv_,"mouseover",function(e){(n.marker_.getDraggable()||n.marker_.getClickable())&&(this.style.cursor="pointer",google.maps.event.trigger(n.marker_,"mouseover",e))}),google.maps.event.addDomListener(this.eventDiv_,"mouseout",function(e){!n.marker_.getDraggable()&&!n.marker_.getClickable()||g||(this.style.cursor=n.marker_.getCursor(),google.maps.event.trigger(n.marker_,"mouseout",e))}),google.maps.event.addDomListener(this.eventDiv_,"mousedown",function(e){g=!1,n.marker_.getDraggable()&&(l=!0,this.style.cursor=_),(n.marker_.getDraggable()||n.marker_.getClickable())&&(google.maps.event.trigger(n.marker_,"mousedown",e),h(e))}),google.maps.event.addDomListener(document,"mouseup",function(t){var i;if(l&&(l=!1,n.eventDiv_.style.cursor="pointer",google.maps.event.trigger(n.marker_,"mouseup",t)),g){if(a){i=n.getProjection().fromLatLngToDivPixel(n.marker_.getPosition()),i.y+=p,n.marker_.setPosition(n.getProjection().fromDivPixelToLatLng(i));try{n.marker_.setAnimation(google.maps.Animation.BOUNCE),setTimeout(v,1406)}catch(r){}}n.crossDiv_.style.display="none",n.marker_.setZIndex(e),s=!0,g=!1,t.latLng=n.marker_.getPosition(),google.maps.event.trigger(n.marker_,"dragend",t)}}),google.maps.event.addListener(n.marker_.getMap(),"mousemove",function(s){var _;l&&(g?(s.latLng=new google.maps.LatLng(s.latLng.lat()-t,s.latLng.lng()-i),_=n.getProjection().fromLatLngToDivPixel(s.latLng),a&&(n.crossDiv_.style.left=_.x+"px",n.crossDiv_.style.top=_.y+"px",n.crossDiv_.style.display="",_.y-=p),n.marker_.setPosition(n.getProjection().fromDivPixelToLatLng(_)),a&&(n.eventDiv_.style.top=_.y+p+"px"),google.maps.event.trigger(n.marker_,"drag",s)):(t=s.latLng.lat()-n.marker_.getPosition().lat(),i=s.latLng.lng()-n.marker_.getPosition().lng(),e=n.marker_.getZIndex(),r=n.marker_.getPosition(),o=n.marker_.getMap().getCenter(),a=n.marker_.get("raiseOnDrag"),g=!0,n.marker_.setZIndex(1e6),s.latLng=n.marker_.getPosition(),google.maps.event.trigger(n.marker_,"dragstart",s)))}),google.maps.event.addDomListener(document,"keydown",function(e){g&&27===e.keyCode&&(a=!1,n.marker_.setPosition(r),n.marker_.getMap().setCenter(o),google.maps.event.trigger(document,"mouseup",e))}),google.maps.event.addDomListener(this.eventDiv_,"click",function(e){(n.marker_.getDraggable()||n.marker_.getClickable())&&(s?s=!1:(google.maps.event.trigger(n.marker_,"click",e),h(e)))}),google.maps.event.addDomListener(this.eventDiv_,"dblclick",function(e){(n.marker_.getDraggable()||n.marker_.getClickable())&&(google.maps.event.trigger(n.marker_,"dblclick",e),h(e))}),google.maps.event.addListener(this.marker_,"dragstart",function(e){g||(a=this.get("raiseOnDrag"))}),google.maps.event.addListener(this.marker_,"drag",function(e){g||a&&(n.setPosition(p),n.labelDiv_.style.zIndex=1e6+(this.get("labelInBackground")?-1:1))}),google.maps.event.addListener(this.marker_,"dragend",function(e){g||a&&n.setPosition(0)}),google.maps.event.addListener(this.marker_,"position_changed",function(){n.setPosition()}),google.maps.event.addListener(this.marker_,"zindex_changed",function(){n.setZIndex()}),google.maps.event.addListener(this.marker_,"visible_changed",function(){n.setVisible()}),google.maps.event.addListener(this.marker_,"labelvisible_changed",function(){n.setVisible()}),google.maps.event.addListener(this.marker_,"title_changed",function(){n.setTitle()}),google.maps.event.addListener(this.marker_,"labelcontent_changed",function(){n.setContent()}),google.maps.event.addListener(this.marker_,"labelanchor_changed",function(){n.setAnchor()}),google.maps.event.addListener(this.marker_,"labelclass_changed",function(){n.setStyles()}),google.maps.event.addListener(this.marker_,"labelstyle_changed",function(){n.setStyles()})]},MarkerLabel_.prototype.onRemove=function(){var e;for(this.labelDiv_.parentNode.removeChild(this.labelDiv_),this.eventDiv_.parentNode.removeChild(this.eventDiv_),e=0;e=0&&this.get("opacity")<=1&&(e.style.opacity=this.get("opacity")),this.get("clickable")===!0&&google.maps.event.addDomListener(e,"click",function(e){google.maps.event.trigger(t,"click",e)}),this.get("draggable")===!0&&(google.maps.event.addDomListener(e,"drag",function(e){google.maps.event.trigger(t,"drag",e)}),google.maps.event.addDomListener(e,"mousedown",function(e){google.maps.event.trigger(t,"dragstart",e),this.style.cursor="move",t.get("map").set("draggable",!1);var i=e;t.moveHandler=google.maps.event.addDomListener(t.get("map").getDiv(),"mousemove",function(e){google.maps.event.trigger(t,"drag",e);var o=i.clientX-e.clientX,n=i.clientY-e.clientY,s=t.getProjection().fromLatLngToDivPixel(t.get("position")),r=t.getProjection().fromDivPixelToLatLng(new google.maps.Point(s.x-o,s.y-n));i=e,t.set("position",r),t.draw()})}),google.maps.event.addDomListener(e,"mouseup",function(e){google.maps.event.trigger(t,"dragend",e),t.get("map").set("draggable",!0),this.style.cursor="default",google.maps.event.removeListener(t.moveHandler)}),google.maps.event.addDomListener(this.get("map").getDiv(),"mouseleave",function(t){google.maps.event.trigger(e,"mouseup",t)})),google.maps.event.addDomListener(e,"mouseover",function(e){google.maps.event.trigger(t,"mouseover",e)}),google.maps.event.addDomListener(e,"mouseout",function(e){google.maps.event.trigger(t,"mouseout",e)});var i=document.createElement("img");if(i.src=this.get("icon").url,i.style.width=this.get("icon").size.width+"px",i.style.height=this.get("icon").size.height+"px",i.style.display="block",i.setAttribute("alt",this.get("title")),e.appendChild(i),""!==this.get("icon").text.content){var o=document.createElement("span");o.textContent=this.get("icon").text.content,o.style.fontFamily=this.get("icon").text.font,o.style.fontSize=this.get("icon").text.size,o.style.fontWeight=this.get("icon").text.weight,o.style.color=this.get("icon").text.color,o.style.position="absolute",o.style.top=this.get("icon").text.position[0]+"px",o.style.left=this.get("icon").text.position[1]+"px",o.style.transform="translate(-50%, -50%)",this.get("container").appendChild(o)}""!==this.get("icon").html&&e.appendChild(this.get("icon").html),this.set("container",e),this.getPanes().overlayImage.appendChild(e)},SVGMarker.prototype.draw=function(){var t=this.getProjection(),e=t.fromLatLngToDivPixel(this.get("position"));this.get("container").style.left=e.x-this.get("icon").anchor.x+"px",this.get("container").style.top=e.y-this.get("icon").anchor.y+"px",this.get("container").style.cursor=this.get("cursor")},SVGMarker.prototype.onRemove=function(){this.get("container").parentNode.removeChild(this.get("container")),this.set("container",null)},SVGMarker.prototype.setZIndex=function(t){this.get("container")&&(this.get("container").style.zIndex=t)},SVGMarker.prototype.setOpacity=function(t){this.get("container")&&(this.get("container").style.opacity=t)},SVGMarker.prototype.hide=function(){this.get("container")&&(this.get("container").style.visibility="hidden")},SVGMarker.prototype.show=function(){this.get("container")&&(this.get("container").style.visibility="visible")},SVGMarker.prototype.toggle=function(){this.get("container")&&("hidden"===this.get("container").style.visibility?this.show():this.hide())},SVGMarker.prototype.getPosition=function(){return this.get("position")},SVGMarker.prototype.toggleDOM=function(){this.getMap()?this.setMap(null):this.setMap(this.get("map"))}; /////svg marker $(document).ready(function(){ initMap(); }); /// 7.32 nautical miles (8.42 miles) to Charleston Harbor var centerLat = 32.823564; var centerLng = -80.020915; var theMap; var mapCenter; var mapZoomStart = 17.5; var zLevelHide = 16; var markersArr = []; var infowindow; var sitePlanOverlay; var markerData; var allowTracking = false; var disableClicks = false; var otherMarker = { url: '/themes/ashleyhall/modules/map/markers/map-pin-03.svg', size: new google.maps.Size(40, 40), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(30, 40) //,scaledSize: new google.maps.Size(30, 30) }; var myLocationIcon = { url: '/themes/ashleyhall/modules/map/markers/map-pin-03.svg', size: new google.maps.Size(40, 40), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(30, 40) ,scaledSize: new google.maps.Size(30, 30) }; function initMap() { if ( $(window).width() < 768 ) { mapZoomStart = 17.12; } mapCenter = new google.maps.LatLng(centerLat,centerLng); var mapOptions = { zoom: mapZoomStart, center: mapCenter, styles: gmap_styles, scrollwheel: false, mapTypeControl: true, fullscreenControl: false, streetViewControl: false }; theMap = new google.maps.Map(document.getElementById('map_canvas_full'), mapOptions); ////// new svg overlay siteSVG = document.querySelector('#siteplanSVG'); const svgBounds = new google.maps.LatLngBounds( new google.maps.LatLng(32.821672, -80.023742), new google.maps.LatLng(32.825966, -80.017036) ); ////new google.maps.LatLng(32.825135, -80.018286) 32.825996, -80.017066 sitePlanOverlay = new SVGOverlay(svgBounds, siteSVG, theMap); //For convenience, zoom in on that area: //theMap.setCenter(svgBounds.getCenter()); //theMap.fitBounds(svgBounds); //Handle normal DOM events on the SVG element(s): addEvent('[id*="Lot"]', 'click', function(e) { e.stopPropagation(); if (disableClicks) { console.log('clicks are disabled'); } else { getLotDetails(e.currentTarget.id); } }); addEvent('[id*="Lot"]', 'dblclick', function(e) { //Avoid zooming here: e.stopPropagation(); }); ////// end new svg overlay markSolds(); addMarkers(markerData); addDistanceOverlay(); addRiverLabelOverlays(); sizeAndPositionMap(); var contentString = "

The Settlement at Ashley Hall

148 Ashley Hall Plantation Road
Charleston, SC

" infowindow = new google.maps.InfoWindow({ content: contentString, maxWidth: 300, pixelOffset: new google.maps.Size(-10, -10) }); //// show/hide siteplan at zoom level google.maps.event.addListener(theMap, 'zoom_changed', showHideSiteplan ); google.maps.event.addListener(theMap, 'bounds_changed', function() { var bounds = theMap.getBounds(); var ne = bounds.getNorthEast(); var sw = bounds.getSouthWest(); //console.log(ne + ' ' + sw); //do whatever you want with those bounds }); ////////// disable clicks while map is dragging ///////// google.maps.event.addListener(theMap, 'drag', function() { disableClicks = true; }); google.maps.event.addListener(theMap, 'dragend', function() { setTimeout(() => { disableClicks = false }, 1000); }); }; // initMap var watchID; var myLocationMarker = null; function getLocation(){ if (navigator.geolocation) { watchID = navigator.geolocation.watchPosition(function(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude }; console.log(pos); //infowindow.setPosition(pos); //infowindow.setContent('Location found.'); //infowindow.open(theMap); theMap.setCenter(pos); /********************************/ if (myLocationMarker == null) { myLocationMarker = new google.maps.Marker({ position: pos, map: theMap, icon: myLocationIcon }); } else { myLocationMarker.setPosition(pos); } /******************************/ }, function() { handleLocationError(true, infowindow, theMap.getCenter()); }); } else { // Browser doesn't support Geolocation handleLocationError(false, infowindow, theMap.getCenter()); } }; function handleLocationError(browserHasGeolocation, infowindow, pos) { infowindow.setPosition(pos); infowindow.setContent(browserHasGeolocation ? 'Error: The Geolocation service failed.' : 'Error: Your browser doesn\'t support geolocation.'); infowindow.open(theMap); } $('.share-loc').click(function(){ if (allowTracking){ allowTracking = false; theMap.setCenter(mapCenter); navigator.geolocation.clearWatch(watchID); }else{ allowTracking = true; getLocation(); } }); function sizeAndPositionMap() { var windowWidth = $(window).width(); switch(true) { case (windowWidth < 500): newcenterLng = centerLng + .0009; var newCenter = new google.maps.LatLng(centerLat,newcenterLng); theMap.setCenter(mapCenter); theMap.setZoom(17); //console.log('case 1: ' + theMap.getZoom()); break; case (windowWidth < 800): theMap.setCenter(mapCenter); theMap.setZoom(17); //console.log('case 2:' + theMap.getZoom()); break; case (windowWidth < 1100): theMap.setCenter(mapCenter); theMap.setZoom(17); //console.log('case 3:' + theMap.getZoom()); break; default: //console.log('default case'); //theMap.panBy(0,0); theMap.setCenter(mapCenter); theMap.setZoom(mapZoomStart); //console.log('case default:' + theMap.getZoom() ); break; } } function getLotDetails(lotNumber) { var strID = lotNumber; var thisID = strID.replace('Lot',''); var $lot = $(this); if ( typeof strID !== "undefined") { if ( strID.indexOf("Lot") > -1 ) { var theData = "lotNumber=" + thisID + "&filename=siteplan"; $.fancybox.open( { src : '/themes/ashleyhall/modules/siteplan2/lot_details.cfm?' + theData, opts : { smallBtn : true, width : '800px', iframe: { css: { width: '1000px'} }, } ,type : 'iframe' } ); } } }; ///////////////// new site plan overlay /** Our custom overlay class, based on this example: http://serversideguy.com/2017/10/31/how-do-i-place-svgs-on-a-google-map-using-custom-overlays/ More info: https://developers.google.com/maps/documentation/javascript/customoverlays */ "use strict"; function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var SVGOverlay = /*#__PURE__*/ function (_google$maps$OverlayV) { _inherits(SVGOverlay, _google$maps$OverlayV); function SVGOverlay(bounds, svg, map) { var _this; _classCallCheck(this, SVGOverlay); _this = _possibleConstructorReturn(this, _getPrototypeOf(SVGOverlay).call(this)); _this.bounds = bounds; _this.svg = svg; _get(_getPrototypeOf(SVGOverlay.prototype), "setMap", _assertThisInitialized(_this)).call(_assertThisInitialized(_this), map); return _this; } /** Will be called when the map is ready for the overlay to be attached. */ _createClass(SVGOverlay, [{ key: "onAdd", value: function onAdd() { var svg = this.svg; svg.style.display = 'block'; svg.style.position = 'absolute'; //Add the SVG element to a map pane/layer that is able to receive mouse events: var panes = _get(_getPrototypeOf(SVGOverlay.prototype), "getPanes", this).call(this); panes.overlayMouseTarget.appendChild(svg); } /** Whenever we need to (re)draw the overlay on the map, including when first added. */ }, { key: "draw", value: function draw() { //Here, we need to find the correct on-screen position for our image. //To achieve that, we simply ask the map's projection to calculate viewport pixels from the image's lat/lng bounds: var projection = _get(_getPrototypeOf(SVGOverlay.prototype), "getProjection", this).call(this), bounds = this.bounds, sw = projection.fromLatLngToDivPixel(bounds.getSouthWest()), ne = projection.fromLatLngToDivPixel(bounds.getNorthEast()); //Place/resize the SVG element: var s = this.svg.style; s.left = sw.x + 'px'; s.top = ne.y + 'px'; s.width = ne.x - sw.x + 'px'; s.height = sw.y - ne.y + 'px'; } }, { key: "hide", value: function hide() { var svg = this.svg; svg.style.display = 'none'; } //hide }, { key: "show", value: function show() { var svg = this.svg; svg.style.display = 'block'; } //show }]); return SVGOverlay; }(google.maps.OverlayView); //SVGOverlay function addEvent(target, type, handler) { var targets = typeof target === 'string' ? Array.from(document.querySelectorAll(target)) : [target]; targets.forEach(function (t) { return google.maps.event.addDomListener(t, type, handler); }); } ///////////////// end new site plan overlay ///////// get and mark solds and under contract function markSolds() { var ajaxurl = "/themes/ashleyhall/modules/siteplan2/siteplan.cfc?method=getLotsForSaleJSON"; $.ajax({ type: "POST", url: ajaxurl, //data: $(form).serialize(), //dataType: "html", success: function(data) { var rJSON = JSON.parse(data); for (var i = 0; i < rJSON.ROWCOUNT; i++) { console.log(rJSON.DATA.LOT_NUMBER[i] + ' rJSON.DATA.SOLD[i]: ' + rJSON.DATA.SOLD[i]); //opacity of .house $('#Lot' + rJSON.DATA.LOT_NUMBER[i]).find('.house').css("opacity", 0); switch( rJSON.DATA.SOLD[i] ) { case 1: $('#Lot' + rJSON.DATA.LOT_NUMBER[i]).attr("class", "sold"); break; case 2: $('#Lot' + rJSON.DATA.LOT_NUMBER[i]).attr("class", "sold under_contract"); break; case 4: $('#Lot' + rJSON.DATA.LOT_NUMBER[i]).find('.house').css("opacity", 1); break; default: break; } }; }, error: function (xhr, textStatus, errorThrown){ //console.log(xhr); alert(errorThrown); } }); }; ///////// get and mark solds and under contract function addDistanceOverlay() { var srcImage = 'https://www.historicashleyhall.com/themes/ashleyhall/modules/siteplan2/images/siteplan-key.svg'; var imageBounds = { north: 32.824359, south: 32.823300, east: -80.016400, west: -80.019500 }; distanceOverlay = new google.maps.GroundOverlay(srcImage,imageBounds); distanceOverlay.setMap(theMap); google.maps.event.addListenerOnce(theMap, 'idle', function(){ distanceOverlay.setOptions({ zIndex: 1000 }); }); }//// end addDistanceOverlay var riverLabelOverlay; function addRiverLabelOverlays() { var srcImage1 = 'https://www.historicashleyhall.com/themes/ashleyhall/modules/siteplan2/images/river-labels.svg'; var imageBounds1 = { north: 32.8273506015964, south: 32.8219411213269, east: -80.01052538631575, west: -80.02643625019209 }; riverLabelOverlay = new google.maps.GroundOverlay(srcImage1,imageBounds1); riverLabelOverlay.setMap(theMap); google.maps.event.addListenerOnce(theMap, 'idle', function(){ riverLabelOverlay.setOptions({ zIndex: 1000 }); }); //(32.76915878320981, -79.89500513779524) (32.763745761585696, -79.91174212204817) var srcImage2 = 'https://www.historicashleyhall.com/themes/ashleyhall/modules/siteplan2/images/Charleston-Harbor-label.svg'; var imageBounds2 = { south: 32.763745761585696, west: -79.91174212204817, north: 32.76915878320981, east: -79.89500513779524}; harborLabelOverlay = new google.maps.GroundOverlay(srcImage2,imageBounds2); harborLabelOverlay.setMap(theMap); google.maps.event.addListenerOnce(theMap, 'idle', function(){ harborLabelOverlay.setOptions({ zIndex: 1000 }); }); }//// end addDistanceOverlay function showHideSiteplan() { zoomLevel = theMap.getZoom(); if (zoomLevel >= zLevelHide) { //sitePlanOverlay.setMap(theMap); sitePlanOverlay.show(); markersArr[0].setMap(null); } else { //sitePlanOverlay.setMap(null); sitePlanOverlay.hide(); markersArr[0].setMap(theMap); } } function offsetMapCenter(map,offsetX, offsetY){ //map.setCenter(mapCenter); map.panBy(offsetX,offsetY); }; $( window ).resize(function() { sizeAndPositionMap(); }); function addMarkers(markerData) { if( markerData != undefined) { var markerTitle; for(var i = 0; i < markerData.ROWCOUNT; i++){ var hasImage = true; var markerID = markerData.DATA.ID[i]; var markerHeadline = markerData.DATA.HEADLINE[i]; var markerSubhead = markerData.DATA.SUBHEAD[i]; var marker_text = String(markerData.DATA.INTRO_TEXT[i]); marker_text = marker_text; var image1 = markerData.DATA.DOCUMENT_FILE_PATH[i] + 'thumb_' + markerData.DATA.DOCUMENT_FILE[i]; var newLatLng = new google.maps.LatLng(markerData.DATA.LATITUDE[i],markerData.DATA.LONGITUDE[i]); if ( markerData.DATA.DOCUMENT_FILE[i] == null){ hasImage = false; } var loadedmarker = new SVGMarker({ map: theMap, position: newLatLng, icon: otherMarker, // custom marker info markerID : markerID, markerHeadline : markerHeadline, markerSubhead : markerSubhead, markerText : marker_text, image : image1, hasImage : hasImage }); markersArr.push(loadedmarker); google.maps.event.addListener(loadedmarker, 'click', markerInfoWindow); }//end for loop }// end if undefined }//end addMarkers function markerInfoWindow(event) { if ( this.hasImage == false ) { var contentString = '

' + this.markerHeadline + '

' + this.markerSubhead + '

' + this.markerText + '

' + '

'; } else { var contentString = '

' + this.markerHeadline + '

' + this.markerSubhead + '

' + this.markerText + '

' + '

' + '
' + '
'; } infowindow.setContent(contentString); infowindow.open(theMap,this); theMap.setCenter(this.getPosition()); theMap.panBy(0,-100); } // show/hide markers function setMapOnAll(theMap) { for (var i = 0; i < markersArr.length; i++) { markersArr[i].setMap(theMap); } }; // Removes the markers from the map, but keeps them in the array. function clearMarkers() { setMapOnAll(null); } // Shows any markers currently in the array. function showMarkers() { setMapOnAll(map); } // show/hide marker labels function showLabels() { for (var i = 0; i < markersArr.length; i++) { markersArr[i].set('labelVisible', true); } }; function hideLabels() { for (var i = 0; i < markersArr.length; i++) { markersArr[i].set('labelVisible', false); } }; function showHideLabelsOnZoom() { if ( theMap.getZoom() < zLevelHide ) { hideLabels(); } else { showLabels(); } }; function findLatInPoints(pointArr,inLat) { // return number of times lat appears in points var result = $.grep(pointArr, function(e){ return e.lat() === inLat; }); return result.length; }// findLat //////////////// overlay //////////////// /////////////// end overlay /////////////// var gmap_styles = [{"elementType":"geometry","stylers":[{"color":"#ebe3cd"}]},{"elementType":"labels.text.fill","stylers":[{"color":"#523735"}]},{"elementType":"labels.text.stroke","stylers":[{"color":"#f5f1e6"}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#c9b2a6"}]},{"featureType":"administrative.land_parcel","elementType":"geometry.stroke","stylers":[{"color":"#dcd2be"}]},{"featureType":"administrative.land_parcel","elementType":"labels.text.fill","stylers":[{"color":"#ae9e90"}]},{"featureType":"administrative.neighborhood","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"geometry.stroke","stylers":[{"color":"#40371d"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#dfd2ae"}]},{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#93817c"}]},{"featureType":"poi.business","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#a5b076"}]},{"featureType":"poi.park","elementType":"labels.text.fill","stylers":[{"color":"#447530"}]},{"featureType":"road","elementType":"geometry","stylers":[{"color":"#f5f1e6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#fdfcf8"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#f8c967"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#e9bc62"}]},{"featureType":"road.highway.controlled_access","elementType":"geometry","stylers":[{"color":"#e98d58"}]},{"featureType":"road.highway.controlled_access","elementType":"geometry.stroke","stylers":[{"color":"#db8555"}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#806b63"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"color":"#dfd2ae"}]},{"featureType":"transit.line","elementType":"labels.text.fill","stylers":[{"color":"#8f7d77"}]},{"featureType":"transit.line","elementType":"labels.text.stroke","stylers":[{"color":"#ebe3cd"}]},{"featureType":"transit.station","elementType":"geometry","stylers":[{"color":"#dfd2ae"}]},{"featureType":"water","elementType":"geometry.fill","stylers":[{"color":"#b9d3c2"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"color":"#92998d"}]}];