var map; var mgr; var icons = {}; var allmarkers = []; function loadGoogleMap() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(46.25782,-72.941258), 15); var extLargeMapControl = new ExtLargeMapControl({type : "small", zoomInBtnTitle : "Rapprocher", zoomOutBtnTitle : "Éloigner"}); map.addControl(extLargeMapControl); window.setTimeout("setupNousJoindre()", 0); } } function getIcon(images) { var icon = null; if (images) { if (icons[images[0]]) { icon = icons[images[0]]; } else { icon = new GIcon(G_DEFAULT_ICON); icon.image = "/google_maps/icones_carte/" + images[0] + ".png"; var size = iconData[images[0]]; icon.iconSize = new GSize(size.width, size.height); icon.iconAnchor = new GPoint(size.width >> 1, size.height >> 1); icon.infoWindowAnchor = new GPoint(12, 4); icon.shadow = null; //size = iconData[images[1]]; //icon.shadowSize = new GSize(size.width, size.height); icons[images[0]] = icon; } } return icon; } function setupNousJoindre() { mgr = new MarkerManager(map, {trackMarkers:false}); allmarkers.length = 0; for (var i in Nous_Joindre) { var layer = Nous_Joindre[i]; var markers = []; for (var j in layer["places"]) { var place = layer["places"][j]; var icon = getIcon(place["icon"]); var title = place["name"]; var infoBulle = place["info"]; var posn = new GLatLng(place["posn"][0], place["posn"][1]); var marker = createMarker(posn,title,icon,infoBulle); markers.push(marker); allmarkers.push(marker); } mgr.addMarkers(markers, layer["zoom"][0], layer["zoom"][1]); } mgr.refresh(); //map.openInfoWindowHtml(map.getCenter(),infoBulle, {pixelOffset: new GSize(-2, -16), noCloseOnClick:true}); } function createMarker(posn, title, icon, infoBulle) { var marker = new GMarker(posn, {title: title, icon: icon, draggable:false }); //GEvent.addListener(marker, 'click', function() { // marker.openInfoWindowHtml(infoBulle); //}); return marker; }