if(!Destinia.maps.adapters){Destinia.maps.adapters={}}Destinia.maps.adapters.GoogleMaps3=function(){this._map=null;this._geoCoder=null};Destinia.maps.adapters.GoogleMaps3.prototype.includeApi=function(){var a=document.createElement("script");a.type="text/javascript";a.src="http://maps.googleapis.com/maps/api/js?sensor=false&callback=Destinia.net.ProxyLoader.launch";document.body.appendChild(a)};Destinia.maps.adapters.GoogleMaps3.prototype.createMap=function(e,g){var a;var f=function(){a=a||new google.maps.LatLngBounds();e.iterate(function(h){if(h instanceof Destinia.maps.Coordinates){a.extend(new google.maps.LatLng(h.getLat(),h.getLng()))}})};if(!e.center||!e.center instanceof Destinia.maps.Coordinates){f();e.center=new Destinia.maps.Coordinates({lat:a.getCenter().lat(),lng:a.getCenter().lng()});e.auto=true}var d=e.center.getLat(),c=e.center.getLng();var b={mapTypeId:google.maps.MapTypeId[e.type],zoom:e.zoom?e.zoom:18,center:new google.maps.LatLng(d,c),disableDefaultUI:e.disableControls};this._map=new google.maps.Map(document.getElementById(e.selector),b);if(e.auto){if(!a){f()}this._map.fitBounds(a)}if(g){g()}};Destinia.maps.adapters.GoogleMaps3.prototype.panTo=function(b,a){this._map.panTo(new google.maps.LatLng(b,a))};Destinia.maps.adapters.GoogleMaps3.prototype.resize=function(){google.maps.event.trigger(this._map,"resize")};Destinia.maps.adapters.GoogleMaps3.prototype.createPolyLine=function(c){var d=[];c.iterate(function(e){d.push(new google.maps.LatLng(e.getLat(),e.getLng()))});var b={clickable:false,strokeColor:c.color,strokeOpacity:c.opacity,strokeWeight:c.weight,geodesic:c.geodesic,path:d,map:this._map};var a=new google.maps.Polyline(b)};Destinia.maps.adapters.GoogleMaps3.prototype.createMarker=function(a){var c=this._map;var b=function(){var h=null,k=null,j=null;if(a.icon.url){h=new google.maps.MarkerImage(a.icon.url,new google.maps.Size(a.icon.width,a.icon.height),new google.maps.Point(0,0),new google.maps.Point(0,a.icon.height))}if(a.shadow.url){k=new google.maps.MarkerImage(a.shadow.url,new google.maps.Size(a.shadow.width,a.shadow.height),new google.maps.Point(0,0),new google.maps.Point(0,a.shadow.height))}var d={position:new google.maps.LatLng(a.getLat(),a.getLng()),icon:h,shadow:k,map:c};if(a.title){d.title=a.title}if("undefined"!=typeof a.label){var g=a.label.length==1?-7:-4;Destinia.extend(d,{labelContent:a.label,labelAnchor:new google.maps.Point(g,26),labelInBackground:false});j=new MarkerWithLabel(d)}else{j=new google.maps.Marker(d)}var f=0,e=a.getEvents();for(;f<e.length;f++){google.maps.event.addListener(j,e[f][0],e[f][1])}if(a.text){j.info=new google.maps.InfoWindow({content:a.text,maxWidth:a.maxWidth});google.maps.event.addListener(j,"click",function(){j.info.open(c,j)})}a._providerMarker=j};if("undefined"!=typeof a.label&&"undefined"===typeof MarkerWithLabel){$.getScript("/headers/common/js/libraries/google/markerwithlabel.js",b)}else{b()}};Destinia.maps.adapters.GoogleMaps3.prototype.addEventListener=function(a,c,b){google.maps.event.addListener(a,c,b)};Destinia.maps.adapters.GoogleMaps3.prototype.geoCodeAddress=function(a,d,c){var b=function(){if(!this._geoCoder){var e="es";this._geoCoder=new google.maps.Geocoder({language:e})}return this._geoCoder};b().geocode({address:a},function(f,e){if(e==google.maps.GeocoderStatus.OK){d.call(c,f[0].geometry.location.lat(),f[0].geometry.location.lng())}else{}})};
