text: var automaticGeoLocation=false;var lastClickedMarker;var searchClicked;var mapAutoZoom;var map;function heroMap(o,r,d,k,m,e,h){if(document.getElementById(d)!=null){if(!h){h=14}if(!u){var u=0}map=new google.maps.Map(document.getElementById(d),{zoom:h,scrollwheel:false,center:new google.maps.LatLng(o,r),mapTypeId:"roadmap",styles:[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#c6c6c6"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#dde6e8"},{visibility:"on"}]}]});var s;if(u==1){google.maps.event.addListener(map,"idle",function(){if(searchClicked!=1){var a={optimized_loading:1,north_east_lat:map.getBounds().getNorthEast().lat(),north_east_lng:map.getBounds().getNorthEast().lng(),south_west_lat:map.getBounds().getSouthWest().lat(),south_west_lng:map.getBounds().getSouthWest().lng()};if(b!=undefined){b.clearMarkers()}c("assets/external/data.php",a)}})}else{google.maps.event.addListenerOnce(map,"idle",function(){c("assets/external/data.php")})}if(e==true){$(".hero-section .map").addClass("show-marker-labels")}var n;var t;var p=[];var j=[];var q=[];var f=[];var b;function l(i){p=[];for(n=0;n<i.length;n++){var y;var A=document.createElement("div");var w;if(i[n]["marker_image"]!=undefined){w=i[n]["marker_image"]}else{w="assets/img/items/default.png"}if(i[n]["featured"]==1){A.innerHTML='<div class="marker" data-id="'+i[n]["id"]+'"><div class="title">'+i[n]["title"]+'</div><div class="marker-wrapper"><div class="tag"><i class="fa fa-check"></i></div><div class="pin"><div class="image" style="background-image: url('+w+');"></div></div></div></div>'}else{A.innerHTML='<div class="marker" data-id="'+i[n]["id"]+'"><div class="title">'+i[n]["title"]+'</div><div class="marker-wrapper"><div class="pin"><div class="image" style="background-image: url('+w+');"></div></div></div>'}if(i[n]["latitude"]&&i[n]["longitude"]&&i[n]["address"]){v(n,"latitudeLongitude")}else{if(i[n]["address"]&&!i[n]["latitude"]&&!i[n]["longitude"]){v(n,"address")}else{if(i[n]["latitude"]&&i[n]["longitude"]&&!i[n]["address"]){v(n,"latitudeLongitude")}else{console.log("No location coordinates")}}}}function v(E,I){if(I=="latitudeLongitude"){y=new RichMarker({position:new google.maps.LatLng(i[E]["latitude"],i[E]["longitude"]),map:map,draggable:false,content:A,flat:true});google.maps.event.addListener(y,"click",(function(J,K){return function(){if(k=="sidebar"){C($(this.content.firstChild).attr("data-id"))}else{if(k=="infobox"){B($(this.content.firstChild).attr("data-id"),this,K)}else{if(k=="modal"){openModal($(this.content.firstChild).attr("data-id"),"modal_item.php")}}}}})(y,E));p.push(y)}else{if(I=="address"){t=E;var H=new google.maps.Geocoder();var G={address:i[E]["address"]};H.geocode(G,D(A))}}if(mapAutoZoom==1){var F=new google.maps.LatLngBounds();for(var E=0;E<p.length;E++){F.extend(p[E].getPosition())}map.fitBounds(F)}}var x;function B(G,F,E){$.ajax({url:"assets/external/infobox.php",dataType:"html",data:{id:G},method:"POST",success:function(H){infoboxOptions={content:H,disableAutoPan:false,pixelOffset:new google.maps.Size(-135,-50),zIndex:null,alignBottom:true,boxClass:"infobox-wrapper",enableEventPropagation:true,closeBoxMargin:"0px 0px -8px 0px",closeBoxURL:"assets/img/close-btn.png",infoBoxClearance:new google.maps.Size(1,1)};if(x!=undefined){x.close()}p[E].infobox=new InfoBox(infoboxOptions);p[E].infobox.open(map,F);x=p[E].infobox;setTimeout(function(){$(".item.infobox[data-id="+G+"]").parent().addClass("show")},10);google.maps.event.addListener(p[E].infobox,"closeclick",function(){$(lastClickedMarker).removeClass("active")})},error:function(){console.log("error")}})}function D(E){return function(H,F){if(F==google.maps.GeocoderStatus.OK){y=new RichMarker({position:H[0].geometry.location,map:map,draggable:false,content:E,flat:true});p.push(y);z();if(mapAutoZoom==1){var I=new google.maps.LatLngBounds();for(var G=0;G<p.length;G++){I.extend(p[G].getPosition())}map.fitBounds(I)}google.maps.event.addListener(y,"click",(function(J,K){return function(){if(k=="sidebar"){C($(this.content.firstChild).attr("data-id"))}else{if(k=="infobox"){B($(this.content.firstChild).attr("data-id"),this,0)}else{if(k=="modal"){openModal($(this.content.firstChild).attr("data-id"),"modal_item.php")}}}}})(y,G))}else{console.log("Geocode failed "+F)}}}function C(E){$.ajax({url:"assets/external/sidebar_detail.php",data:{id:E},method:"POST",success:function(F){$(".sidebar-wrapper").html(F);$(".results-wrapper").removeClass("loading");initializeOwl();ratingPassive(".sidebar-wrapper .sidebar-content");initializeFitVids();socialShare();initializeReadMore();$(".sidebar-wrapper .back").on("click",function(){$(".results-wrapper").removeClass("show-detail");$(lastClickedMarker).removeClass("active")});$(document).keyup(function(G){switch(G.which){case 27:$(".sidebar-wrapper .back").trigger("click");break}});$(".results-wrapper").addClass("show-detail")},error:function(F){console.log("error "+F)}})}$(".marker").live("mouseenter",function(){var E=$(this).attr("data-id");$(".results-wrapper .results-content .result-item[data-id="+E+"] a").addClass("hover-state")}).live("mouseleave",function(){var E=$(this).attr("data-id");$(".results-wrapper .results-content .result-item[data-id="+E+"] a").removeClass("hover-state")});$(".marker").live("click",function(){var E=$(this).attr("data-id");$(lastClickedMarker).removeClass("active");$(this).addClass("active");lastClickedMarker=$(this)});var a=[{url:"assets/img/cluster.png",height:36,width:36}];b=new MarkerClusterer(map,p,{styles:a,maxZoom:16,ignoreHidden:true});google.maps.event.addListener(map,"idle",function(){z()});z();function z(){j=[];q=[];f=[];for(var E=0;E<p.length;E++){if(map.getBounds().contains(p[E].getPosition())){f.push(p[E]);q.push($(p[E].content.firstChild).attr("data-id"));p[E].setVisible(true)}else{p[E].setVisible(false)}}b.repaint();if($(".hero-section").hasClass("sidebar-grid")){var F="assets/external/sidebar_results_grid.php"}else{F="assets/external/sidebar_results.php"}$.ajax({url:F,method:"POST",data:{markers:q},success:function(G){j.push(G);$(".results-wrapper .results-content").html(G);$(".results-wrapper .section-title h2 .results-number").html(q.length);ratingPassive(".results-wrapper .results");$(".result-item").on("mouseenter",function(){$(".map .marker[data-id="+$(this).attr("data-id")+"]").addClass("hover-state")}).on("mouseleave",function(){$(".map .marker[data-id="+$(this).attr("data-id")+"]").removeClass("hover-state")});trackpadScroll("recalculate");$(".result-item, .results-content .item").children("a").on("click",function(H){if(m=="sidebar"){H.preventDefault();C($(this).parent().attr("data-id"))}else{if(m=="modal"){H.preventDefault();openModal($(this).parent().attr("data-id"),"modal_item.php")}}$(lastClickedMarker).removeClass("active");$(".map .marker[data-id="+$(this).parent().attr("data-id")+"]").addClass("active");lastClickedMarker=$(".map .marker[data-id="+$(this).parent().attr("data-id")+"]")})},error:function(G){console.log(G)}})}}$("[data-ajax-response='map']").on("click",function(w){w.preventDefault();var i=$(this).attr("data-ajax-data-file");searchClicked=1;if($(this).attr("data-ajax-auto-zoom")==1){mapAutoZoom=1}var v=$(this).closest("form");var a=v.serialize();b.clearMarkers();c(i,a)});function c(i,a){$.ajax({url:i,dataType:"json",method:"POST",data:a,cache:false,success:function(w){for(var v=0;v<p.length;v++){p[v].setMap(null)}s=w;l(w)},error:function(v){console.log(v)}})}function g(i){var a=new google.maps.LatLng(i.coords.latitude,i.coords.longitude);map.panTo(a);$("#map").removeClass("fade-map")}$(".geo-location").on("click",function(){if(navigator.geolocation){$("#map").addClass("fade-map");navigator.geolocation.getCurrentPosition(g)}else{console.log("Geo Location is not supported")}});if(automaticGeoLocation==true){navigator.geolocation.getCurrentPosition(g)}autoComplete(map)}else{}}function reloadMap(){google.maps.event.trigger(map,"resize")}function simpleMap(i,j,d,a,c){if(!a){a=false}var g,b,f;if(c){b=new google.maps.Geocoder();f={address:c};b.geocode(f,e());function e(){return function(l,k){if(k==google.maps.GeocoderStatus.OK){g=new google.maps.LatLng(l[0].geometry.location.lat(),l[0].geometry.location.lng());h(g)}else{console.log("Geocode failed");console.log(k)}}}}else{g=new google.maps.LatLng(i,j);h(g)}function h(n){var l={zoom:14,center:n,disableDefaultUI:true,scrollwheel:true,styles:[{featureType:"all",elementType:"labels.text.fill",stylers:[{saturation:36},{color:"#333333"},{lightness:40}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{lightness:16}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#fefefe"},{lightness:20}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#fefefe"},{lightness:17},{weight:1.2}]},{featureType:"landscape",elementType:"geometry",stylers:[{lightness:20},{color:"#ececec"}]},{featureType:"landscape.man_made",elementType:"all",stylers:[{visibility:"on"},{color:"#f0f0ef"}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#f0f0ef"}]},{featureType:"landscape.man_made",elementType:"geometry.stroke",stylers:[{visibility:"on"},{color:"#d4d4d4"}]},{featureType:"landscape.natural",elementType:"all",stylers:[{visibility:"on"},{color:"#ececec"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi",elementType:"geometry",stylers:[{lightness:21},{visibility:"off"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#d4d4d4"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#303030"}]},{featureType:"poi",elementType:"labels.icon",stylers:[{saturation:"-100"}]},{featureType:"poi.attraction",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#dedede"},{lightness:21}]},{featureType:"poi.place_of_worship",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.school",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.school",elementType:"geometry.stroke",stylers:[{lightness:"-61"},{gamma:"0.00"},{visibility:"off"}]},{featureType:"poi.sports_complex",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{lightness:17}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#ffffff"},{lightness:29},{weight:0.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:18}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#ffffff"},{lightness:16}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#f2f2f2"},{lightness:19}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#dadada"},{lightness:17}]}]};var m=document.getElementById(d);var o=new google.maps.Map(m,l);var k=new RichMarker({position:n,map:o,draggable:a,content:"<img src='assets/img/marker.png'>",flat:true});google.maps.event.addListener(k,"dragend",function(){var q=this.position.lat();var p=this.position.lng();$("#latitude").val(this.position.lat());$("#longitude").val(this.position.lng())});autoComplete(o,k)}}function autoComplete(d,a){if($("#address-autocomplete").length){if(!d){d=new google.maps.Map(document.getElementById("address-autocomplete"))}var b=document.getElementById("address-autocomplete");var c=new google.maps.places.Autocomplete(b);c.bindTo("bounds",d);google.maps.event.addListener(c,"place_changed",function(){var g=c.getPlace();if(!g.geometry){return}if(g.geometry.viewport){d.fitBounds(g.geometry.viewport)}else{d.setCenter(g.geometry.location);d.setZoom(17)}if(a){a.setPosition(g.geometry.location);a.setVisible(true);$("#latitude").val(a.getPosition().lat());$("#longitude").val(a.getPosition().lng())}var f="";if(g.address_components){f=[(g.address_components[0]&&g.address_components[0].short_name||""),(g.address_components[1]&&g.address_components[1].short_name||""),(g.address_components[2]&&g.address_components[2].short_name||"")].join(" ")}});function e(f){d.setCenter(new google.maps.LatLng(f.coords.latitude,f.coords.longitude));$("#latitude").val(f.coords.latitude);$("#longitude").val(f.coords.longitude)}$(".geo-location").on("click",function(){if(navigator.geolocation){$("#"+element).addClass("fade-map");navigator.geolocation.getCurrentPosition(e)}else{console.log("Geo Location is not supported")}})}};
  