window.markers=[];const iconoMarcador=window.imagespath+"/ic-pin-map-negro.png";const iconoMarcadorAmbassador=window.imagespath+"/ic-pin-map-ambassador-sm.png";const infowindow=new google.maps.InfoWindow;const geocoder=new google.maps.Geocoder;let map=null;let punto={};document.addEventListener("DOMContentLoaded",function(event){document.addEventListener("click",handleClicks)});function handleClicks(event){if(event.target&&event.target.classList.contains("js-doZoomLocation")){const indice=event.target.dataset.indice;hacerZoomLocalizacion(window.markers[indice],indice)}else if(event.target.classList.contains("js-doZoomBounds")){hacerZoomBounds(event.target.dataset.bounds)}}function initializeGoogleMaps(mapid,puntos,puntoindex,lang,aMapas,defaultMapa){let params=new URL(document.location).searchParams;let postalCode=params.get("codigo_postal");if(!puntoindex)puntoindex=-1;let minZoomLevel=2;let mapOptions={zoomControl:true,mapTypeId:google.maps.MapTypeId.MAP,styles:[{stylers:[{hue:"#006CC4"},{saturation:-20}]}]};if(defaultMapa!=null){mapOptions.center=new google.maps.LatLng(aMapas[defaultMapa][2],aMapas[defaultMapa][3]);mapOptions.zoom=aMapas[defaultMapa][4]}map=new google.maps.Map(document.getElementById(mapid),mapOptions);google.maps.event.addListener(map,"zoom_changed",function(){if(map.getZoom()=0;i--){let mapzoneControlDiv=document.createElement("div");mapzoneControlDiv.index=1;map.controls[google.maps.ControlPosition.TOP_RIGHT].push(mapzoneControlDiv)}cargarLocalizaciones(puntos);if(puntoindex==-1){if(defaultMapa!=null){map.setCenter(new google.maps.LatLng(aMapas[defaultMapa][2],aMapas[defaultMapa][3]));map.setZoom(aMapas[defaultMapa][4])}else{hacerZoomBounds(puntos)}}else{let ptSelected=null;puntos.every(function(pt){if(pt[7]==puntoindex){ptSelected=puntos.indexOf(pt);return false}return true});if(ptSelected!=null){let marker=window.markers[ptSelected];map.setCenter(marker.getPosition());map.setZoom(15);punto={content:getMarkerHTML(ptSelected,puntos,marker)};infowindow.setContent(punto.content);infowindow.open(map,marker)}else{if(defaultMapa!=null){map.setCenter(new google.maps.LatLng(aMapas[defaultMapa][2],aMapas[defaultMapa][3]));map.setZoom(aMapas[defaultMapa][4])}else{hacerZoomBounds(puntos)}}}const markers=window.markers;const renderer={render({count,position},stats){const color=count>Math.max(10,stats.clusters.markers.mean)?"#003D71":"#015196";const svg=window.btoa(` `);return new google.maps.Marker({position:position,icon:{url:`data:image/svg+xml;base64,${svg}`,scaledSize:new google.maps.Size(45,45)},label:{text:String(count),color:"rgba(255,255,255,0.9)",fontSize:"12px"},title:`Cluster of ${count} markers`,zIndex:Number(google.maps.Marker.MAX_ZINDEX)+count})}};new markerClusterer.MarkerClusterer({map:map,markers:markers,renderer:renderer});if(postalCode!=null&&postalCode!=="")codeAddress(postalCode)}function cargarLocalizaciones(puntos){window.markers=[];for(let i=0;i";strHTML+='
';strHTML+='';strHTML+='';strHTML+="
"}if(typeof puntos[indice][8]!="undefined"&&puntos[indice].image!=""&&puntos[indice].image!="none"){strHTML+='
'+""+puntos[indice].titulo+""+"
"}if(typeof puntos[indice].numeroDeCuenta!="undefined"&&puntos[indice].numeroDeCuenta!="")strHTML+=''+puntos[indice].numeroDeCuenta+"
";if(typeof puntos[indice].nombreDeCuenta!="undefined"&&puntos[indice].nombreDeCuenta!="")strHTML+="
"+puntos[indice].nombreDeCuenta;if(typeof puntos[indice].direccion!="undefined"&&puntos[indice].direccion!="")strHTML+="
"+puntos[indice].direccion+"
";if(typeof puntos[indice].ciudad!="undefined"&&puntos[indice].ciudad!="")strHTML+="
"+puntos[indice].ciudad+" ";if(typeof puntos[indice].codigoPostal!="undefined"&&puntos[indice].codigoPostal!="")strHTML+=", "+puntos[indice].codigoPostal+" ";if(typeof puntos[indice].provincia!="undefined"&&puntos[indice].provincia!="")strHTML+=", "+puntos[indice].provincia+"
";if(typeof puntos[indice].telefono!="undefined"&&puntos[indice].telefono!="")strHTML+="
"+lblTel+": "+puntos[indice].telefono+"";if(typeof puntos[indice].fax!="undefined"&&puntos[indice].fax!="")strHTML+="
"+lblFax+": "+puntos[indice].fax;if(typeof puntos[indice].email!="undefined"&&puntos[indice].email!="")strHTML+="
"+lblEmail+": "+puntos[indice].email+"";if(typeof puntos[indice].web!="undefined"&&puntos[indice].web!="")strHTML+="
"+lblWeb+": "+puntos[indice].web+"";strHTML+="";return strHTML}function hacerZoomLocalizacion(marker,indice){map.setCenter(marker.getPosition());map.setZoom(15)}function hacerZoomBounds(puntos){let bounds=new google.maps.LatLngBounds;for(let i=0;i