1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
geocoder = new GClientGeocoder();
function createMarkersEtbl(i) {
var coordonees = etbl[i][4];
if (coordonees) {
var point = new GLatLng(coordonees);
alert(point);
var marker=(new GMarker(point));
batchEtbl.push(marker);
var infoTabs = [
new GInfoWindowTab("Adresse", ('<span class=a-resultats-menu><?echo $texte_resultats["text23"] ?>'+etbl[i][3]+'<? echo " " ?>'+etbl[i][1]+'<? echo "<br><br><\/span><a href='+etbl[i][2]+' class=resultats-menu>" ?>'+etbl[i][1]+'<\/a>')),
];
GEvent.addListener(marker, "mouseover", function() {
marker.openInfoWindowTabsHtml(infoTabs);
});
GEvent.addListener(marker, "click", function() {
window.location.href = etbl[i][2];
});
if (i+1<etbl.length) {
createMarkersEtbl(i+1);
} else {
mgr.addMarkers(batchEtbl, 5);
mgr.refresh();
}
} else {
if (geocoder) {
geocoder.getLatLng(etbl[i][0], function(point) {
if (point) {
var marker=new GMarker(point);
batchEtbl.push(marker);
var infoTabs = [
new GInfoWindowTab("Adresse", ('<span class=a-resultats-menu><?echo $texte_resultats["text23"] ?>'+etbl[i][3]+'<? echo " " ?>'+etbl[i][1]+'<? echo "<br><br><\/span><a href='+etbl[i][2]+' class=resultats-menu>" ?>'+etbl[i][1]+'<\/a>')),
];
GEvent.addListener(marker, "mouseover", function() {
marker.openInfoWindowTabsHtml(infoTabs);
});
GEvent.addListener(marker, "click", function() {
window.location.href = etbl[i][2];
});
}
if (i+1<etbl.length) {
createMarkersEtbl(i+1);
} else {
mgr.addMarkers(batchEtbl, 5);
mgr.refresh();
}
});
}
}
}
map.setCenter(new GLatLng(48.9, 2.3), 5);
map.addControl(new GMapTypeControl());
map.addControl(new GSmallMapControl());
map.enableScrollWheelZoom();
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl());
centrecarte(address);
createMarkersEtbl(0);//lancement de la fonction permettant de créer les markers des pays
mgr = new GMarkerManager(map);//on créer un marker manager//création d'un manager de marker
}
} |
Partager