Your IP : 216.73.216.147


Current Path : /home/lejardintz/www/media/foundry/3.1/scripts/
Upload File :
Current File : /home/lejardintz/www/media/foundry/3.1/scripts/gmaps.min.js

!function(){var moduleFactory=function($){var module=this,callbackId=$.callback(function(){window.google||window.google.maps||module.reject("Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.");var GMaps=function(){"use strict";var doc=document,getElementById=function(id,context){return $("#"+id.replace("#",""),context)[0]},GMaps=function(options){var self=this,events_that_hide_context_menu=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","idle","maptypeid_changed","projection_changed","resize","tilesloaded","zoom_changed"],events_that_doesnt_hide_context_menu=["mousemove","mouseout","mouseover"];
if(window.context_menu={},this.el="string"==typeof options.el||"string"==typeof options.div?getElementById(options.el||options.div,options.context):options.el||options.div,"undefined"==typeof this.el||null===this.el)throw"No element defined.";this.el.style.width=options.width||this.el.scrollWidth||this.el.offsetWidth,this.el.style.height=options.height||this.el.scrollHeight||this.el.offsetHeight,this.controls=[],this.overlays=[],this.layers=[],this.singleLayers={},this.markers=[],this.polylines=[],this.routes=[],this.polygons=[],this.infoWindow=null,this.overlay_el=null,this.zoom=options.zoom||15,this.registered_events={};
var mapType,markerClusterer=options.markerClusterer;mapType=options.mapType?google.maps.MapTypeId[options.mapType.toUpperCase()]:google.maps.MapTypeId.ROADMAP;var map_center=new google.maps.LatLng(options.lat,options.lng);delete options.el,delete options.lat,delete options.lng,delete options.mapType,delete options.width,delete options.height,delete options.markerClusterer;var zoomControlOpt=options.zoomControlOpt||{style:"DEFAULT",position:"TOP_LEFT"},zoomControl=options.zoomControl||!0,zoomControlStyle=zoomControlOpt.style||"DEFAULT",zoomControlPosition=zoomControlOpt.position||"TOP_LEFT",panControl=options.panControl||!0,mapTypeControl=options.mapTypeControl||!0,scaleControl=options.scaleControl||!0,streetViewControl=options.streetViewControl||!0,overviewMapControl=overviewMapControl||!0,map_options={},map_base_options={zoom:this.zoom,center:map_center,mapTypeId:mapType},map_controls_options={panControl:panControl,zoomControl:zoomControl,zoomControlOptions:{style:google.maps.ZoomControlStyle[zoomControlStyle],position:google.maps.ControlPosition[zoomControlPosition]},mapTypeControl:mapTypeControl,scaleControl:scaleControl,streetViewControl:streetViewControl,overviewMapControl:overviewMapControl};
1!=options.disableDefaultUI&&(map_base_options=extend_object(map_base_options,map_controls_options)),map_options=extend_object(map_base_options,options);for(var i=0;i<events_that_hide_context_menu.length;i++)delete map_options[events_that_hide_context_menu[i]];for(var i=0;i<events_that_doesnt_hide_context_menu.length;i++)delete map_options[events_that_doesnt_hide_context_menu[i]];this.map=new google.maps.Map(this.el,map_options),markerClusterer&&(this.markerClusterer=markerClusterer.apply(this,[this.map]));var findAbsolutePosition=function(obj){var curleft=0,curtop=0;
if(obj.offsetParent)do curleft+=obj.offsetLeft,curtop+=obj.offsetTop;while(obj=obj.offsetParent);return[curleft,curtop]},buildContextMenuHTML=function(control,e){var html="",options=window.context_menu[control];for(var i in options)if(options.hasOwnProperty(i)){var option=options[i];html+='<li><a id="'+control+"_"+i+'" href="#">'+option.title+"</a></li>"}if(getElementById("gmaps_context_menu")){var context_menu_element=getElementById("gmaps_context_menu");context_menu_element.innerHTML=html;for(var context_menu_items=context_menu_element.getElementsByTagName("a"),context_menu_items_count=context_menu_items.length,i=0;context_menu_items_count>i;i++){var context_menu_item=context_menu_items[i],assign_menu_item_action=function(ev){ev.preventDefault(),options[this.id.replace(control+"_","")].action.apply(self,[e]),self.hideContextMenu()
};google.maps.event.clearListeners(context_menu_item,"click"),google.maps.event.addDomListenerOnce(context_menu_item,"click",assign_menu_item_action,!1)}var position=findAbsolutePosition.apply(this,[self.el]),left=position[0]+e.pixel.x-15,top=position[1]+e.pixel.y-15;context_menu_element.style.left=left+"px",context_menu_element.style.top=top+"px",context_menu_element.style.display="block"}},buildContextMenu=function(control,e){if("marker"===control){e.pixel={};var overlay=new google.maps.OverlayView;overlay.setMap(self.map),overlay.draw=function(){var projection=overlay.getProjection(),position=e.marker.getPosition();
e.pixel=projection.fromLatLngToContainerPixel(position),buildContextMenuHTML(control,e)}}else buildContextMenuHTML(control,e)};this.setContextMenu=function(options){window.context_menu[options.control]={};for(var i in options.options)if(options.options.hasOwnProperty(i)){var option=options.options[i];window.context_menu[options.control][option.name]={title:option.title,action:option.action}}var ul=doc.createElement("ul");ul.id="gmaps_context_menu",ul.style.display="none",ul.style.position="absolute",ul.style.minWidth="100px",ul.style.background="white",ul.style.listStyle="none",ul.style.padding="8px",ul.style.boxShadow="2px 2px 6px #ccc",doc.body.appendChild(ul);
var context_menu_element=getElementById("gmaps_context_menu");google.maps.event.addDomListener(context_menu_element,"mouseout",function(ev){ev.relatedTarget&&this.contains(ev.relatedTarget)||window.setTimeout(function(){context_menu_element.style.display="none"},400)},!1)},this.hideContextMenu=function(){var context_menu_element=getElementById("gmaps_context_menu");context_menu_element&&(context_menu_element.style.display="none")};for(var setupListener=function(object,name){google.maps.event.addListener(object,name,function(e){void 0==e&&(e=this),options[name].apply(this,[e]),self.hideContextMenu()
})},ev=0;ev<events_that_hide_context_menu.length;ev++){var name=events_that_hide_context_menu[ev];name in options&&setupListener(this.map,name)}for(var ev=0;ev<events_that_doesnt_hide_context_menu.length;ev++){var name=events_that_doesnt_hide_context_menu[ev];name in options&&setupListener(this.map,name)}google.maps.event.addListener(this.map,"rightclick",function(e){options.rightclick&&options.rightclick.apply(this,[e]),void 0!=window.context_menu.map&&buildContextMenu("map",e)}),this.refresh=function(){google.maps.event.trigger(this.map,"resize")
},this.fitZoom=function(){for(var latLngs=[],markers_length=this.markers.length,i=0;markers_length>i;i++)latLngs.push(this.markers[i].getPosition());this.fitLatLngBounds(latLngs)},this.fitLatLngBounds=function(latLngs){for(var total=latLngs.length,bounds=new google.maps.LatLngBounds,i=0;total>i;i++)bounds.extend(latLngs[i]);this.map.fitBounds(bounds)},this.setCenter=function(lat,lng,callback){this.map.panTo(new google.maps.LatLng(lat,lng)),callback&&callback()},this.getElement=function(){return this.el},this.zoomIn=function(value){value=value||1,this.zoom=this.map.getZoom()+value,this.map.setZoom(this.zoom)
},this.zoomOut=function(value){value=value||1,this.zoom=this.map.getZoom()-value,this.map.setZoom(this.zoom)};var native_methods=[];for(var method in this.map)"function"!=typeof this.map[method]||this[method]||native_methods.push(method);for(var i=0;i<native_methods.length;i++)!function(gmaps,scope,method_name){gmaps[method_name]=function(){return scope[method_name].apply(scope,arguments)}}(this,this.map,native_methods[i]);this.createControl=function(options){var control=doc.createElement("div");control.style.cursor="pointer",control.style.fontFamily="Arial, sans-serif",control.style.fontSize="13px",control.style.boxShadow="rgba(0, 0, 0, 0.398438) 0px 2px 4px";
for(var option in options.style)control.style[option]=options.style[option];options.id&&(control.id=options.id),options.classes&&(control.className=options.classes),options.content&&(control.innerHTML=options.content);for(var ev in options.events)!function(object,name){google.maps.event.addDomListener(object,name,function(){options.events[name].apply(this,[this])})}(control,ev);return control.index=1,control},this.addControl=function(options){var position=google.maps.ControlPosition[options.position.toUpperCase()];
delete options.position;var control=this.createControl(options);return this.controls.push(control),this.map.controls[position].push(control),control},this.createMarker=function(options){if(options.hasOwnProperty("lat")&&options.hasOwnProperty("lng")||options.position){var self=this,details=options.details,fences=options.fences,outside=options.outside,base_options={position:new google.maps.LatLng(options.lat,options.lng),map:null};delete options.lat,delete options.lng,delete options.fences,delete options.outside;
var marker_options=extend_object(base_options,options),marker=new google.maps.Marker(marker_options);if(marker.fences=fences,options.infoWindow){marker.infoWindow=new google.maps.InfoWindow(options.infoWindow);for(var info_window_events=["closeclick","content_changed","domready","position_changed","zindex_changed"],ev=0;ev<info_window_events.length;ev++)!function(object,name){options.infoWindow[name]&&google.maps.event.addListener(object,name,function(e){options.infoWindow[name].apply(this,[e])})}(marker.infoWindow,info_window_events[ev])
}for(var marker_events=["animation_changed","clickable_changed","cursor_changed","draggable_changed","flat_changed","icon_changed","position_changed","shadow_changed","shape_changed","title_changed","visible_changed","zindex_changed"],marker_events_with_mouse=["dblclick","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup"],ev=0;ev<marker_events.length;ev++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(){options[name].apply(this,[this])})}(marker,marker_events[ev]);
for(var ev=0;ev<marker_events_with_mouse.length;ev++)!function(map,object,name){options[name]&&google.maps.event.addListener(object,name,function(me){me.pixel||(me.pixel=map.getProjection().fromLatLngToPoint(me.latLng)),options[name].apply(this,[me])})}(this.map,marker,marker_events_with_mouse[ev]);return google.maps.event.addListener(marker,"click",function(){this.details=details,options.click&&options.click.apply(this,[this]),marker.infoWindow&&(self.hideInfoWindows(),marker.infoWindow.open(self.map,marker))
}),google.maps.event.addListener(marker,"rightclick",function(e){e.marker=this,options.rightclick&&options.rightclick.apply(this,[e]),void 0!=window.context_menu.marker&&buildContextMenu("marker",e)}),marker.fences&&google.maps.event.addListener(marker,"dragend",function(){self.checkMarkerGeofence(marker,function(m,f){outside(m,f)})}),marker}throw"No latitude or longitude defined."},this.addMarker=function(options){var marker;if(options.hasOwnProperty("gm_accessors_"))marker=options;else{if(!(options.hasOwnProperty("lat")&&options.hasOwnProperty("lng")||options.position))throw"No latitude or longitude defined.";
marker=this.createMarker(options)}return marker.setMap(this.map),this.markerClusterer&&this.markerClusterer.addMarker(marker),this.markers.push(marker),GMaps.fire("marker_added",marker,this),marker},this.addMarkers=function(array){for(var marker,i=0;marker=array[i];i++)this.addMarker(marker);return this.markers},this.hideInfoWindows=function(){for(var marker,i=0;marker=this.markers[i];i++)marker.infoWindow&&marker.infoWindow.close()},this.removeMarker=function(marker){for(var i=0;i<this.markers.length;i++)if(this.markers[i]===marker){this.markers[i].setMap(null),this.markers.splice(i,1),GMaps.fire("marker_removed",marker,this);
break}return marker},this.removeMarkers=function(collection){for(var collection=collection||this.markers,i=0;i<this.markers.length;i++)this.markers[i]===collection[i]&&this.markers[i].setMap(null);for(var new_markers=[],i=0;i<this.markers.length;i++)null!=this.markers[i].getMap()&&new_markers.push(this.markers[i]);this.markers=new_markers},this.drawOverlay=function(options){var overlay=new google.maps.OverlayView;overlay.setMap(self.map);var auto_show=!0;return null!=options.auto_show&&(auto_show=options.auto_show),overlay.onAdd=function(){var el=doc.createElement("div");
el.style.borderStyle="none",el.style.borderWidth="0px",el.style.position="absolute",el.style.zIndex=100,el.innerHTML=options.content,overlay.el=el;var panes=this.getPanes();options.layer||(options.layer="overlayLayer");var overlayLayer=panes[options.layer];overlayLayer.appendChild(el);for(var stop_overlay_events=["contextmenu","DOMMouseScroll","dblclick","mousedown"],ev=0;ev<stop_overlay_events.length;ev++)!function(object,name){google.maps.event.addDomListener(object,name,function(e){-1!=navigator.userAgent.toLowerCase().indexOf("msie")&&document.all?(e.cancelBubble=!0,e.returnValue=!1):e.stopPropagation()
})}(el,stop_overlay_events[ev]);google.maps.event.trigger(this,"ready")},overlay.draw=function(){var projection=this.getProjection(),pixel=projection.fromLatLngToDivPixel(new google.maps.LatLng(options.lat,options.lng));options.horizontalOffset=options.horizontalOffset||0,options.verticalOffset=options.verticalOffset||0;var el=overlay.el,content=el.children[0],content_height=content.clientHeight,content_width=content.clientWidth;switch(options.verticalAlign){case"top":el.style.top=pixel.y-content_height+options.verticalOffset+"px";
break;default:case"middle":el.style.top=pixel.y-content_height/2+options.verticalOffset+"px";break;case"bottom":el.style.top=pixel.y+options.verticalOffset+"px"}switch(options.horizontalAlign){case"left":el.style.left=pixel.x-content_width+options.horizontalOffset+"px";break;default:case"center":el.style.left=pixel.x-content_width/2+options.horizontalOffset+"px";break;case"right":el.style.left=pixel.x+options.horizontalOffset+"px"}el.style.display=auto_show?"block":"none",auto_show||options.show.apply(this,[el])
},overlay.onRemove=function(){var el=overlay.el;options.remove?options.remove.apply(this,[el]):(overlay.el.parentNode.removeChild(overlay.el),overlay.el=null)},self.overlays.push(overlay),overlay},this.removeOverlay=function(overlay){for(var i=0;i<this.overlays.length;i++)if(this.overlays[i]===overlay){this.overlays[i].setMap(null),this.overlays.splice(i,1);break}},this.removeOverlays=function(){for(var item,i=0;item=self.overlays[i];i++)item.setMap(null);self.overlays=[]},this.drawPolyline=function(options){var path=[],points=options.path;
if(points.length)if(void 0===points[0][0])path=points;else for(var latlng,i=0;latlng=points[i];i++)path.push(new google.maps.LatLng(latlng[0],latlng[1]));var polyline_options={map:this.map,path:path,strokeColor:options.strokeColor,strokeOpacity:options.strokeOpacity,strokeWeight:options.strokeWeight,geodesic:options.geodesic,clickable:!0,editable:!1,visible:!0};options.hasOwnProperty("clickable")&&(polyline_options.clickable=options.clickable),options.hasOwnProperty("editable")&&(polyline_options.editable=options.editable),options.hasOwnProperty("icons")&&(polyline_options.icons=options.icons),options.hasOwnProperty("zIndex")&&(polyline_options.zIndex=options.zIndex);
for(var polyline=new google.maps.Polyline(polyline_options),polyline_events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],ev=0;ev<polyline_events.length;ev++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(e){options[name].apply(this,[e])})}(polyline,polyline_events[ev]);return this.polylines.push(polyline),GMaps.fire("polyline_added",polyline,this),polyline},this.removePolyline=function(polyline){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i]===polyline){this.polylines[i].setMap(null),this.polylines.splice(i,1),GMaps.fire("polyline_removed",polyline,this);
break}},this.removePolylines=function(){for(var item,i=0;item=self.polylines[i];i++)item.setMap(null);self.polylines=[]},this.drawCircle=function(options){options=extend_object({map:this.map,center:new google.maps.LatLng(options.lat,options.lng)},options),delete options.lat,delete options.lng;for(var polygon=new google.maps.Circle(options),polygon_events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],ev=0;ev<polygon_events.length;ev++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(e){options[name].apply(this,[e])
})}(polygon,polygon_events[ev]);return this.polygons.push(polygon),polygon},this.drawRectangle=function(options){options=extend_object({map:this.map},options);var latLngBounds=new google.maps.LatLngBounds(new google.maps.LatLng(options.bounds[0][0],options.bounds[0][1]),new google.maps.LatLng(options.bounds[1][0],options.bounds[1][1]));options.bounds=latLngBounds;for(var polygon=new google.maps.Rectangle(options),polygon_events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],ev=0;ev<polygon_events.length;ev++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(e){options[name].apply(this,[e])
})}(polygon,polygon_events[ev]);return this.polygons.push(polygon),polygon},this.drawPolygon=function(options){var useGeoJSON=!1;options.hasOwnProperty("useGeoJSON")&&(useGeoJSON=options.useGeoJSON),delete options.useGeoJSON,options=extend_object({map:this.map},options),0==useGeoJSON&&(options.paths=[options.paths.slice(0)]),options.paths.length>0&&options.paths[0].length>0&&(options.paths=array_flat(array_map(options.paths,arrayToLatLng,useGeoJSON)));for(var polygon=new google.maps.Polygon(options),polygon_events=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],ev=0;ev<polygon_events.length;ev++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(e){options[name].apply(this,[e])
})}(polygon,polygon_events[ev]);return this.polygons.push(polygon),GMaps.fire("polygon_added",polygon,this),polygon},this.removePolygon=function(polygon){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i]===polygon){this.polygons[i].setMap(null),this.polygons.splice(i,1),GMaps.fire("polygon_removed",polygon,this);break}},this.removePolygons=function(){for(var item,i=0;item=self.polygons[i];i++)item.setMap(null);self.polygons=[]},this.getFromFusionTables=function(options){var events=options.events;delete options.events;
var fusion_tables_options=options,layer=new google.maps.FusionTablesLayer(fusion_tables_options);for(var ev in events)!function(object,name){google.maps.event.addListener(object,name,function(e){events[name].apply(this,[e])})}(layer,ev);return this.layers.push(layer),layer},this.loadFromFusionTables=function(options){var layer=this.getFromFusionTables(options);return layer.setMap(this.map),layer},this.getFromKML=function(options){var url=options.url,events=options.events;delete options.url,delete options.events;
var kml_options=options,layer=new google.maps.KmlLayer(url,kml_options);for(var ev in events)!function(object,name){google.maps.event.addListener(object,name,function(e){events[name].apply(this,[e])})}(layer,ev);return this.layers.push(layer),layer},this.loadFromKML=function(options){var layer=this.getFromKML(options);return layer.setMap(this.map),layer};var travelMode,unitSystem;this.getRoutes=function(options){switch(options.travelMode){case"bicycling":travelMode=google.maps.TravelMode.BICYCLING;break;case"transit":travelMode=google.maps.TravelMode.TRANSIT;
break;case"driving":travelMode=google.maps.TravelMode.DRIVING;break;default:travelMode=google.maps.TravelMode.WALKING}unitSystem="imperial"===options.unitSystem?google.maps.UnitSystem.IMPERIAL:google.maps.UnitSystem.METRIC;var base_options={avoidHighways:!1,avoidTolls:!1,optimizeWaypoints:!1,waypoints:[]},request_options=extend_object(base_options,options);request_options.origin=/string/.test(typeof options.origin)?options.origin:new google.maps.LatLng(options.origin[0],options.origin[1]),request_options.destination=new google.maps.LatLng(options.destination[0],options.destination[1]),request_options.travelMode=travelMode,request_options.unitSystem=unitSystem,delete request_options.callback;
var self=this,service=new google.maps.DirectionsService;service.route(request_options,function(result,status){if(status===google.maps.DirectionsStatus.OK)for(var r in result.routes)result.routes.hasOwnProperty(r)&&self.routes.push(result.routes[r]);options.callback&&options.callback(self.routes)})},this.removeRoutes=function(){this.routes=[]},this.getElevations=function(options){options=extend_object({locations:[],path:!1,samples:256},options),options.locations.length>0&&options.locations[0].length>0&&(options.locations=array_flat(array_map([options.locations],arrayToLatLng,!1)));
var callback=options.callback;delete options.callback;var service=new google.maps.ElevationService;if(options.path){var pathRequest={path:options.locations,samples:options.samples};service.getElevationAlongPath(pathRequest,function(result,status){callback&&"function"==typeof callback&&callback(result,status)})}else delete options.path,delete options.samples,service.getElevationForLocations(options,function(result,status){callback&&"function"==typeof callback&&callback(result,status)})},this.cleanRoute=this.removePolylines,this.drawRoute=function(options){var self=this;
this.getRoutes({origin:options.origin,destination:options.destination,travelMode:options.travelMode,waypoints:options.waypoints,unitSystem:options.unitSystem,callback:function(e){e.length>0&&(self.drawPolyline({path:e[e.length-1].overview_path,strokeColor:options.strokeColor,strokeOpacity:options.strokeOpacity,strokeWeight:options.strokeWeight}),options.callback&&options.callback(e[e.length-1]))}})},this.travelRoute=function(options){if(options.origin&&options.destination)this.getRoutes({origin:options.origin,destination:options.destination,travelMode:options.travelMode,waypoints:options.waypoints,callback:function(e){if(e.length>0&&options.start&&options.start(e[e.length-1]),e.length>0&&options.step){var route=e[e.length-1];
if(route.legs.length>0)for(var step,steps=route.legs[0].steps,i=0;step=steps[i];i++)step.step_number=i,options.step(step,route.legs[0].steps.length-1)}e.length>0&&options.end&&options.end(e[e.length-1])}});else if(options.route&&options.route.legs.length>0)for(var step,steps=options.route.legs[0].steps,i=0;step=steps[i];i++)step.step_number=i,options.step(step)},this.drawSteppedRoute=function(options){if(options.origin&&options.destination)this.getRoutes({origin:options.origin,destination:options.destination,travelMode:options.travelMode,waypoints:options.waypoints,callback:function(e){if(e.length>0&&options.start&&options.start(e[e.length-1]),e.length>0&&options.step){var route=e[e.length-1];
if(route.legs.length>0)for(var step,steps=route.legs[0].steps,i=0;step=steps[i];i++)step.step_number=i,self.drawPolyline({path:step.path,strokeColor:options.strokeColor,strokeOpacity:options.strokeOpacity,strokeWeight:options.strokeWeight}),options.step(step,route.legs[0].steps.length-1)}e.length>0&&options.end&&options.end(e[e.length-1])}});else if(options.route&&options.route.legs.length>0)for(var step,steps=options.route.legs[0].steps,i=0;step=steps[i];i++)step.step_number=i,self.drawPolyline({path:step.path,strokeColor:options.strokeColor,strokeOpacity:options.strokeOpacity,strokeWeight:options.strokeWeight}),options.step(step)
},this.checkGeofence=function(lat,lng,fence){return fence.containsLatLng(new google.maps.LatLng(lat,lng))},this.checkMarkerGeofence=function(marker,outside_callback){if(marker.fences)for(var fence,i=0;fence=marker.fences[i];i++){var pos=marker.getPosition();self.checkGeofence(pos.lat(),pos.lng(),fence)||outside_callback(marker,fence)}},this.addLayer=function(layerName,options){options=options||{};var layer;switch(layerName){case"weather":this.singleLayers.weather=layer=new google.maps.weather.WeatherLayer;break;
case"clouds":this.singleLayers.clouds=layer=new google.maps.weather.CloudLayer;break;case"traffic":this.singleLayers.traffic=layer=new google.maps.TrafficLayer;break;case"transit":this.singleLayers.transit=layer=new google.maps.TransitLayer;break;case"bicycling":this.singleLayers.bicycling=layer=new google.maps.BicyclingLayer;break;case"panoramio":this.singleLayers.panoramio=layer=new google.maps.panoramio.PanoramioLayer,layer.setTag(options.filter),delete options.filter,options.click&&google.maps.event.addListener(layer,"click",function(event){options.click(event),delete options.click
});break;case"places":if(this.singleLayers.places=layer=new google.maps.places.PlacesService(this.map),options.search||options.nearbySearch){var placeSearchRequest={bounds:options.bounds||null,keyword:options.keyword||null,location:options.location||null,name:options.name||null,radius:options.radius||null,rankBy:options.rankBy||null,types:options.types||null};options.search&&layer.search(placeSearchRequest,options.search),options.nearbySearch&&layer.nearbySearch(placeSearchRequest,options.nearbySearch)}if(options.textSearch){var textSearchRequest={bounds:options.bounds||null,location:options.location||null,query:options.query||null,radius:options.radius||null};
layer.textSearch(textSearchRequest,options.textSearch)}}return void 0!==layer?("function"==typeof layer.setOptions&&layer.setOptions(options),"function"==typeof layer.setMap&&layer.setMap(this.map),layer):void 0},this.removeLayer=function(layerName){void 0!==this.singleLayers[layerName]&&(this.singleLayers[layerName].setMap(null),delete this.singleLayers[layerName])},this.toImage=function(options){var options=options||{},static_map_options={};if(static_map_options.size=options.size||[this.el.clientWidth,this.el.clientHeight],static_map_options.lat=this.getCenter().lat(),static_map_options.lng=this.getCenter().lng(),this.markers.length>0){static_map_options.markers=[];
for(var i=0;i<this.markers.length;i++)static_map_options.markers.push({lat:this.markers[i].getPosition().lat(),lng:this.markers[i].getPosition().lng()})}if(this.polylines.length>0){var polyline=this.polylines[0];static_map_options.polyline={},static_map_options.polyline.path=google.maps.geometry.encoding.encodePath(polyline.getPath()),static_map_options.polyline.strokeColor=polyline.strokeColor,static_map_options.polyline.strokeOpacity=polyline.strokeOpacity,static_map_options.polyline.strokeWeight=polyline.strokeWeight
}return GMaps.staticMapURL(static_map_options)},this.addMapType=function(mapTypeId,options){if(!options.hasOwnProperty("getTileUrl")||"function"!=typeof options.getTileUrl)throw"'getTileUrl' function required.";options.tileSize=options.tileSize||new google.maps.Size(256,256);var mapType=new google.maps.ImageMapType(options);this.map.mapTypes.set(mapTypeId,mapType)},this.addOverlayMapType=function(options){if(!options.hasOwnProperty("getTile")||"function"!=typeof options.getTile)throw"'getTile' function required.";
var overlayMapTypeIndex=options.index;delete options.index,this.map.overlayMapTypes.insertAt(overlayMapTypeIndex,options)},this.removeOverlayMapType=function(overlayMapTypeIndex){this.map.overlayMapTypes.removeAt(overlayMapTypeIndex)},this.addStyle=function(options){var styledMapType=new google.maps.StyledMapType(options.styles,options.styledMapName);this.map.mapTypes.set(options.mapTypeId,styledMapType)},this.setStyle=function(mapTypeId){this.map.setMapTypeId(mapTypeId)},this.createPanorama=function(streetview_options){return streetview_options.hasOwnProperty("lat")&&streetview_options.hasOwnProperty("lng")||(streetview_options.lat=this.getCenter().lat(),streetview_options.lng=this.getCenter().lng()),this.panorama=GMaps.createPanorama(streetview_options),this.map.setStreetView(this.panorama),this.panorama
},this.on=function(event_name,handler){return GMaps.on(event_name,this,handler)},this.off=function(event_name){GMaps.off(event_name,this)}};return GMaps.createPanorama=function(options){var el=getElementById(options.el,options.context);options.position=new google.maps.LatLng(options.lat,options.lng),delete options.el,delete options.context,delete options.lat,delete options.lng;for(var streetview_events=["closeclick","links_changed","pano_changed","position_changed","pov_changed","resize","visible_changed"],streetview_options=extend_object({visible:!0},options),i=0;i<streetview_events.length;i++)delete streetview_options[streetview_events[i]];
for(var panorama=new google.maps.StreetViewPanorama(el,streetview_options),i=0;i<streetview_events.length;i++)!function(object,name){options[name]&&google.maps.event.addListener(object,name,function(){options[name].apply(this)})}(panorama,streetview_events[i]);return panorama},GMaps.Route=function(options){this.map=options.map,this.route=options.route,this.step_count=0,this.steps=this.route.legs[0].steps,this.steps_length=this.steps.length,this.polyline=this.map.drawPolyline({path:new google.maps.MVCArray,strokeColor:options.strokeColor,strokeOpacity:options.strokeOpacity,strokeWeight:options.strokeWeight}).getPath(),this.back=function(){if(this.step_count>0){this.step_count--;
var path=this.route.legs[0].steps[this.step_count].path;for(var p in path)path.hasOwnProperty(p)&&this.polyline.pop()}},this.forward=function(){if(this.step_count<this.steps_length){var path=this.route.legs[0].steps[this.step_count].path;for(var p in path)path.hasOwnProperty(p)&&this.polyline.push(path[p]);this.step_count++}}},GMaps.geolocate=function(options){var complete_callback=options.always||options.complete;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(position){options.success(position),complete_callback&&complete_callback()
},function(error){options.error(error),complete_callback&&complete_callback()},options.options):(options.not_supported(),complete_callback&&complete_callback())},GMaps.geocode=function(options){this.geocoder=new google.maps.Geocoder;var callback=options.callback;options.hasOwnProperty("lat")&&options.hasOwnProperty("lng")&&(options.latLng=new google.maps.LatLng(options.lat,options.lng)),delete options.lat,delete options.lng,delete options.callback,this.geocoder.geocode(options,function(results,status){callback(results,status)
})},GMaps.staticMapURL=function(options){function parseColor(color,opacity){if("#"===color[0]&&(color=color.replace("#","0x"),opacity)){if(opacity=parseFloat(opacity),opacity=Math.min(1,Math.max(opacity,0)),0===opacity)return"0x00000000";opacity=(255*opacity).toString(16),1===opacity.length&&(opacity+=opacity),color=color.slice(0,8)+opacity}return color}var data,parameters=[],static_root="http://maps.googleapis.com/maps/api/staticmap";options.url&&(static_root=options.url,delete options.url),static_root+="?";
var markers=options.markers;delete options.markers,!markers&&options.marker&&(markers=[options.marker],delete options.marker);var polyline=options.polyline;if(delete options.polyline,options.center)parameters.push("center="+options.center),delete options.center;else if(options.address)parameters.push("center="+options.address),delete options.address;else if(options.lat)parameters.push(["center=",options.lat,",",options.lng].join("")),delete options.lat,delete options.lng;else if(options.visible){var visible=encodeURI(options.visible.join("|"));
parameters.push("visible="+visible)}var size=options.size;size?(size.join&&(size=size.join("x")),delete options.size):size="630x300",parameters.push("size="+size),options.zoom||(options.zoom=15);var sensor=options.hasOwnProperty("sensor")?!!options.sensor:!0;delete options.sensor,parameters.push("sensor="+sensor);for(var param in options)options.hasOwnProperty(param)&&parameters.push(param+"="+options[param]);if(markers)for(var marker,loc,i=0;data=markers[i];i++)marker=[],data.size&&"normal"!==data.size?marker.push("size:"+data.size):data.icon&&marker.push("icon:"+encodeURI(data.icon)),data.color&&marker.push("color:"+data.color.replace("#","0x")),data.label&&marker.push("label:"+data.label[0].toUpperCase()),loc=data.address?data.address:data.lat+","+data.lng,marker.length||0===i?(marker.push(loc),marker=marker.join("|"),parameters.push("markers="+encodeURI(marker))):(marker=parameters.pop()+encodeURI("|"+loc),parameters.push(marker));
if(polyline){if(data=polyline,polyline=[],data.strokeWeight&&polyline.push("weight:"+parseInt(data.strokeWeight,10)),data.strokeColor){var color=parseColor(data.strokeColor,data.strokeOpacity);polyline.push("color:"+color)}if(data.fillColor){var fillcolor=parseColor(data.fillColor,data.fillOpacity);polyline.push("fillcolor:"+fillcolor)}var path=data.path;if(path.join)for(var pos,j=0;pos=path[j];j++)polyline.push(pos.join(","));else polyline.push("enc:"+path);polyline=polyline.join("|"),parameters.push("path="+encodeURI(polyline))
}return parameters=parameters.join("&"),static_root+parameters},GMaps.custom_events=["marker_added","marker_removed","polyline_added","polyline_removed","polygon_added","polygon_removed","geolocated","geolocation_failed"],GMaps.on=function(event_name,object,handler){if(-1==GMaps.custom_events.indexOf(event_name))return google.maps.event.addListener(object,event_name,handler);var registered_event={handler:handler,eventName:event_name};return object.registered_events[event_name]=object.registered_events[event_name]||[],object.registered_events[event_name].push(registered_event),registered_event
},GMaps.off=function(event_name,object){-1==GMaps.custom_events.indexOf(event_name)?google.maps.event.clearListeners(object,event_name):object.registered_events[event_name]=[]},GMaps.fire=function(event_name,object,scope){if(-1==GMaps.custom_events.indexOf(event_name))google.maps.event.trigger(object,event_name,Array.prototype.slice.apply(arguments).slice(2));else if(event_name in scope.registered_events)for(var firing_events=scope.registered_events[event_name],i=0;i<firing_events.length;i++)!function(handler,scope,object){handler.apply(scope,[object])
}(firing_events[i].handler,scope,object)},google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(){for(var path,bounds=new google.maps.LatLngBounds,paths=this.getPaths(),p=0;p<paths.getLength();p++){path=paths.getAt(p);for(var i=0;i<path.getLength();i++)bounds.extend(path.getAt(i))}return bounds}),google.maps.Polygon.prototype.containsLatLng||(google.maps.Polygon.prototype.containsLatLng=function(latLng){var bounds=this.getBounds();if(null!==bounds&&!bounds.contains(latLng))return!1;
for(var inPoly=!1,numPaths=this.getPaths().getLength(),p=0;numPaths>p;p++)for(var path=this.getPaths().getAt(p),numPoints=path.getLength(),j=numPoints-1,i=0;numPoints>i;i++){var vertex1=path.getAt(i),vertex2=path.getAt(j);(vertex1.lng()<latLng.lng()&&vertex2.lng()>=latLng.lng()||vertex2.lng()<latLng.lng()&&vertex1.lng()>=latLng.lng())&&vertex1.lat()+(latLng.lng()-vertex1.lng())/(vertex2.lng()-vertex1.lng())*(vertex2.lat()-vertex1.lat())<latLng.lat()&&(inPoly=!inPoly),j=i}return inPoly}),google.maps.LatLngBounds.prototype.containsLatLng=function(latLng){return this.contains(latLng)
},google.maps.Marker.prototype.setFences=function(fences){this.fences=fences},google.maps.Marker.prototype.addFence=function(fence){this.fences.push(fence)},GMaps}(this),coordsToLatLngs=function(coords,useGeoJSON){var first_coord=coords[0],second_coord=coords[1];return useGeoJSON&&(first_coord=coords[1],second_coord=coords[0]),new google.maps.LatLng(first_coord,second_coord)},arrayToLatLng=function(coords,useGeoJSON){for(var i=0;i<coords.length;i++)coords[i]=coords[i].length>0&&"number"!=typeof coords[i][0]?arrayToLatLng(coords[i],useGeoJSON):coordsToLatLngs(coords[i],useGeoJSON);
return coords},extend_object=function(obj,new_obj){if(obj===new_obj)return obj;for(var name in new_obj)obj[name]=new_obj[name];return obj},array_map=function(array,callback){var original_callback_params=Array.prototype.slice.call(arguments,2);if(Array.prototype.map&&array.map===Array.prototype.map)return Array.prototype.map.call(array,function(item){return callback_params=original_callback_params,callback_params.splice(0,0,item),callback.apply(this,callback_params)});for(var array_return=[],array_length=array.length,i=0;array_length>i;i++)callback_params=original_callback_params,callback_params=callback_params.splice(0,0,array[i]),array_return.push(callback.apply(this,callback_params));
return array_return},array_flat=function(array){new_array=[];for(var i=0;i<array.length;i++)new_array=new_array.concat(array[i]);return new_array};$.GMaps=GMaps,$.GMaps.mapEvents=["bounds_changed","center_changed","click","dblclick","drag","dragend","dragstart","heading_changed","idle","maptypeid_changed","mousemove","mouseout","mouseover","projection_changed","resize","rightclick","tilesloaded","tilt_changed","zoom_changed"],$.fn.gmaps=function(options){if(!(this.length<1)){var el=$(this[0]),map=el.data("gmaps"),newInstance=void 0===map,autodetect=void 0===options;
if($.isString(options)&&(options={address:options}),newInstance){var id=$.uid("gmaps-"),defaultOptions={lat:0,lng:0};return $.isPlainObject(options)&&(options=$.extend({},defaultOptions,options)),el.attr("id",id),options.div="#"+id,$.each($.GMaps.mapEvents,function(i,eventName){var originalEvent=$.isFunction(options[eventName])?options[eventName]:$.noop;options[eventName]=function(){var args=$.makeArray(arguments);originalEvent.apply(map,arguments),el.trigger.apply(el,["map_"+eventName].concat(args))}}),map=new GMaps(options),el.data("gmaps",map),map.go=function(lat,lng){map.setCenter(lat,lng),map.addMarker({lat:lat,lng:lng})
},autodetect&&GMaps.geolocate({success:function(position){map.go(position.coords.latitude,position.coords.longitude)}}),map}var lat=options.lat,lng=options.lng;return($.isNumber(lat)||$.isNumber(lng))&&map.go(lat,lng),map}},module.resolveWith(GMaps)});$.require().script($.uri(window.location).protocol()+"://maps.google.com/maps/api/js?sensor=true&callback="+callbackId).done()};FD31.module("gmaps",moduleFactory)}();