WS_OK_7.4.33
!function(a){"use strict";a.AviaMapsAPI=function(e,t){void 0!==window.av_google_map?(this.container=t,this.$container=a(t),this.$body=a("body"),this.$mapid=this.$container.data("mapid"),this.$data=window.av_google_map[this.$mapid],this.retina=window.devicePixelRatio>1,this._init(e)):a.avia_utilities.log("Map creation stopped, var av_google_map not found")},a.AviaMapsAPI.apiFiles={loading:!1,finished:!1,src:""},a.AviaMapsAPI.prototype={_init:function(){if(this.$body.hasClass("av-gmaps-no-google-fonts")){var e=document.getElementsByTagName("head")[0],t=e.insertBefore;e.insertBefore=function(a,o){a.href&&(a.href.indexOf("//fonts.googleapis.com/css?family=Roboto")>-1||a.href.indexOf("//fonts.googleapis.com/css?family=Google+Sans+Text")>-1)?console.info("Prevented gMaps from loading gFonts!"):t.call(e,a,o)}}if(void 0===avia_framework_globals.gmap_maps_loaded||""==avia_framework_globals.gmap_maps_loaded){var o="string"==typeof avia_framework_globals.gmap_version?avia_framework_globals.gmap_version:"weekly";a.AviaMapsAPI.apiFiles.src="https://maps.googleapis.com/maps/api/js?v="+o+"&callback=aviaOnGoogleMapsLoaded",void 0!==avia_framework_globals.gmap_api&&""!=avia_framework_globals.gmap_api&&(a.AviaMapsAPI.apiFiles.src+="&key="+avia_framework_globals.gmap_api)}else a.AviaMapsAPI.apiFiles.src=avia_framework_globals.gmap_maps_loaded;this._bind_execution(),this._getAPI()},_getAPI:function(){if(void 0!==window.google&&void 0!==window.google.maps||0!=a.AviaMapsAPI.apiFiles.loading)(void 0!==window.google&&void 0!==window.google.maps||0==a.AviaMapsAPI.apiFiles.loading)&&this._applyMap();else{a.AviaMapsAPI.apiFiles.loading=!0;var e=document.createElement("script");e.id="av-google-maps-api",e.type="text/javascript",e.src=a.AviaMapsAPI.apiFiles.src,document.body.appendChild(e)}},_bind_execution:function(){this.$body.on("av-google-maps-api-loaded",this._applyMap.bind(this))},_applyMap:function(){if(void 0===this.map)if(this.$data.marker&&this.$data.marker[0]&&this.$data.marker[0].lat&&this.$data.marker[0].long){var e=this,t=(!a.avia_utilities.isMobile||this.$data.mobile_drag_control,"auto"==this.$data.zoom?10:this.$data.zoom),o=!1,i=google.maps.MapTypeId.ROADMAP,s=google.maps.MapTypeControlStyle.DROPDOWN_MENU;switch(this.$data.maptype_control){case"dropdown":o=!0,s=google.maps.MapTypeControlStyle.DROPDOWN_MENU;break;case"horizontal":o=!0,s=google.maps.MapTypeControlStyle.HORIZONTAL_BAR;break;case"default":o=!0,s=google.maps.MapTypeControlStyle.DEFAULT;break;default:o=!1,s=google.maps.MapTypeControlStyle.DROPDOWN_MENU}switch(this.$data.maptype_id){case"SATELLITE":i=google.maps.MapTypeId.SATELLITE;break;case"HYBRID":i=google.maps.MapTypeId.HYBRID;break;case"TERRAIN":i=google.maps.MapTypeId.TERRAIN;break;default:i=google.maps.MapTypeId.ROADMAP}void 0===this.$data.scrollwheel&&(this.$data.scrollwheel=!1),void 0===this.$data.gestureHandling&&(this.$data.gestureHandling="cooperative"),void 0===this.$data.backgroundColor&&(this.$data.backgroundColor="transparent"),void 0===this.$data.styles&&(this.$data.styles=[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]}]),this.mapVars={mapMaker:!1,backgroundColor:this.$data.backgroundColor,streetViewControl:this.$data.streetview_control,zoomControl:this.$data.zoom_control,gestureHandling:this.$data.gestureHandling,scrollwheel:this.$data.scrollwheel,zoom:t,mapTypeControl:o,mapTypeControlOptions:{style:s},mapTypeId:i,center:new google.maps.LatLng(this.$data.marker[0].lat,this.$data.marker[0].long),styles:"string"==typeof this.$data.styles?JSON.parse(this.$data.styles):this.$data.styles},this.map=new google.maps.Map(this.container,this.mapVars),this.$container.removeClass("av_gmaps_show_delayed av_gmaps_show_unconditionally"),this.$container.addClass("av_gmaps_map_attached"),this._applyMapStyle(),"auto"==this.$data.zoom&&this._setAutoZoom(),google.maps.event.addListenerOnce(this.map,"tilesloaded",(function(){e._addMarkers()}));var l=this.map;setTimeout((function(){google.maps.event.trigger(l,"resize")}),100)}else a.avia_utilities.log("Latitude or Longitude missing. Make sure you did not only enter an address. You need to fetch the coordinates too.","map-error")},_setAutoZoom:function(){var a=new google.maps.LatLngBounds;for(var e in this.$data.marker)a.extend(new google.maps.LatLng(this.$data.marker[e].lat,this.$data.marker[e].long));this.map.fitBounds(a)},_applyMapStyle:function(){var a,e=[],t=[],o="";if(""!=this.$data.hue&&e.push({hue:this.$data.hue}),""!=this.$data.saturation&&e.push({saturation:this.$data.saturation}),e.length){if(t=[{featureType:"all",elementType:"all",stylers:e},{featureType:"poi",stylers:[{visibility:"off"}]}],"fill"==this.$data.saturation){var i=(o=this.$data.hue||"#242424").substring(1),s=parseInt(i,16),l=.2126*(s>>16&255)+.7152*(s>>8&255)+.0722*(s>>0&255),r=2;l>60&&(-1,r=3),l>220&&(-2,r=-2),t=[{featureType:"all",elementType:"all",stylers:[{color:o},{lightness:0}]},{featureType:"all",elementType:"labels.text.fill",stylers:[{color:o},{lightness:25*r}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:o},{lightness:3}]},{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:o},{lightness:30}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:o},{lightness:30},{weight:1.2}]},{featureType:"landscape",elementType:"geometry",stylers:[{visibility:"simplified"},{color:o},{lightness:3}]},{featureType:"poi",elementType:"geometry",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:o},{lightness:-3}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:o},{lightness:2},{weight:.2}]},{featureType:"road.arterial",elementType:"geometry",stylers:[{color:o},{lightness:-3}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:o},{lightness:-3}]},{featureType:"transit",elementType:"geometry",stylers:[{color:o},{lightness:-3}]},{featureType:"water",elementType:"geometry",stylers:[{color:o},{lightness:-20}]}]}a=new google.maps.StyledMapType(t,{name:"av_map_style"}),this.map.mapTypes.set("av_styled_map",a),this.map.setMapTypeId("av_styled_map")}},_addMarkers:function(){for(var e in this.$data.marker)!function(e,t){setTimeout((function(){var o="";if(t.$data.marker[e]&&t.$data.marker[e].lat&&t.$data.marker[e].long){t.$data.LatLng=new google.maps.LatLng(t.$data.marker[e].lat,t.$data.marker[e].long);var i={flat:!1,position:t.$data.LatLng,animation:google.maps.Animation.BOUNCE,map:t.map,title:t.$data.marker[e].address,optimized:!1};if(t.$data.marker[e].icon&&t.$data.marker[e].imagesize){var s,l,r=t.$data.marker[e].imagesize;t.retina&&r>40&&(r=40),s=new google.maps.Point(r/2,r),l=new google.maps.Size(r,r),i.icon=new google.maps.MarkerImage(t.$data.marker[e].icon,null,null,s,l)}o=new google.maps.Marker(i),setTimeout((function(){o.setAnimation(null),t._infoWindow(t.map,o,t.$data.marker[e])}),500)}else a.avia_utilities.log("Latitude or Longitude for single marker missing","map-error")}),200*(parseInt(e,10)+1))}(e,this);this._show_close_icon()},_show_close_icon:function(){var e=this;setTimeout((function(){a("body").find(".gm-ui-hover-effect:not(.avia-show-gm-notice)").addClass("avia-show-gm-notice"),e._show_close_icon()}),500)},_infoWindow:function(a,e,t){var o=t.content;if("string"==typeof o&&""!=(o=o.trim())){var i=new google.maps.InfoWindow({content:o});google.maps.event.addListener(e,"click",(function(){i.open({anchor:e,map:a,shouldFocus:!1})})),t.tooltip_display&&i.open({anchor:e,map:a,shouldFocus:!1})}}},a.fn.aviaMaps=function(e){return this.each((function(){var t=a.data(this,"aviaMapsApi");t||(t=a.data(this,"aviaMapsApi",new a.AviaMapsAPI(e,this)))}))},window.aviaOnGoogleMapsLoaded=function(){a("body").trigger("av-google-maps-api-loaded"),a.AviaMapsAPI.apiFiles.finished=!0},a("body").trigger("avia-google-maps-api-script-loaded")}(jQuery);