//", buttonZoomingHTML: "", buttonStartingStyle: {width: '24px', height: '24px'} }; GDownloadUrl("http://www.letalapet.fr/index.php?dotmap.xml", function(data) { var xml = GXml.parse(data); /* Creation widget map */ if (document.getElementById("widget_map")) { activemap["widget_map"] = new GMap2(document.getElementById("widget_map")); ; activemap["widget_map"].setCenter(new GLatLng(0,0),1); ; ; } /* Creation home map */ if (document.getElementById("dotmap_homemap")) { activemap["dotmap_homemap"] = new GMap2(document.getElementById("dotmap_homemap")); activemap["dotmap_homemap"].addControl(new GLargeMapControl()); activemap["dotmap_homemap"].setCenter(homecenterpoint,0); // Init map activemap["dotmap_homemap"].setMapType(G_HYBRID_MAP); activemap["dotmap_homemap"].addControl(new GMapTypeControl()); activemap["dotmap_homemap"].addControl(new DragZoomControl(OptionsStyleRectangle, OptionsBouton), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT,new GSize(10,10))); } /* home et widget map */ if (document.getElementById("dotmap_homemap") || document.getElementById("widget_map")) { var hmm = xml.documentElement.getElementsByTagName("homemapmarkers"); var ptr = hmm[0].getElementsByTagName("plot"); for (var i = 0 ; i < ptr.length; i++) { var point = new GLatLng(parseFloat(ptr[i].getAttribute("lat")), parseFloat(ptr[i].getAttribute("lon"))); if (document.getElementById("widget_map") && ptr[i].getAttribute("widget") == "1") { arrayOfWidgetMarkers.push(createXmlWidgetmapMarker(point, GXml.value(ptr[i].getElementsByTagName("infowindow_content")[0]))); } arrayOfMarkers.push(createXmlHomemapMarker(point, GXml.value(ptr[i].getElementsByTagName("infowindow_content")[0]))); } } if (document.getElementById("dotmap_homemap")) { var clusterhome=new ClusterMarker(activemap["dotmap_homemap"], { markers:arrayOfMarkers } ); clusterhome.clusteringEnabled=true; clusterhome.clusterMarkerTitle = 'Clic to zoom in and see %count markers'; clusterhome.refresh(); ; ; } if (document.getElementById("widget_map")) { var clusterwidget=new ClusterMarker(activemap["widget_map"], { markers:arrayOfWidgetMarkers } ); clusterwidget.clusteringEnabled=true; clusterwidget.clusterMarkerTitle = 'Clic to zoom in and see %count markers'; clusterwidget.refresh(); activemap["widget_map"].setCenter(new GLatLng(0,0),1); } /* post maps */ var pmm = xml.documentElement.getElementsByTagName("postmapmarkers"); var ptr = pmm[0].getElementsByTagName("plot"); for (var i = 0; i < ptr.length; i++) { var mapname = ptr[i].getAttribute("mapname"); if (document.getElementById(mapname)) { var lat = parseFloat(ptr[i].getAttribute("lat")); var lon = parseFloat(ptr[i].getAttribute("lon")); var point = new GLatLng(lat,lon); if (!activemap[mapname]) { activemap[mapname] = new GMap2(document.getElementById(mapname)); activemap[mapname].setCenter(new GLatLng(lat,lon), 15); activemap[mapname].setMapType(G_HYBRID_MAP); activemap[mapname].addControl(new GLargeMapControl()); activemap[mapname].addControl(new GMapTypeControl()); } var marker = createXmlPostmapMarker(point, GXml.value(ptr[i].getElementsByTagName("infowindow_content")[0])); activemap[mapname].addOverlay(marker); } } }); /* function(data) */ } function createXmlHomemapMarker(point, html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { homecenterpoint = activemap["dotmap_homemap"].getCenter(); homezoomlevel = activemap["dotmap_homemap"].getZoom(); activemap["dotmap_homemap"].setCenter(marker.getPoint(), 15); marker.openInfoWindowHtml(html); }); GEvent.addListener(marker, "infowindowclose", function() { activemap["dotmap_homemap"].setCenter(homecenterpoint,homezoomlevel); }); return marker; } function createXmlPostmapMarker(point, html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } function createXmlWidgetmapMarker(point, html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } //]]>