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
|
function initialize() {
var map = new google.maps.Map(document.getElementById("map"),{
center: new google.maps.LatLng(46.437977776397446, 5.788854406750033),
zoom: 8,
mapTypeId: 'hybrid',
});
var infoWindow = new google.maps.InfoWindow;
downloadUrl("phpsqlajax_genxml.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var idsite = markers[i].getAttribute("idsite");
var idsortie = markers[i].getAttribute("idsortie");
var nom_site = markers[i].getAttribute("nom_site");
var point = new google.maps.LatLng(
markers[i].getAttribute("lat"),
markers[i].getAttribute("lng"));
var html = "<div id=\"InfoText\"><div class=\"tabs\"><ul><li><a href=\"#tab1\">Details</a></li><li><a href=\"#tab2\" id=\"SV\">Picture</a></li></ul><div id=\"tab1\"><form action=\"index.php?page=page\" method=\"POST\"><b>"+"\derniere observation le\:"+"</b> <br/>" + dateobs +"</b>"+" à " +"</b>"+ heure_debut + "</b> <br/>"+nom_site+"+"</b><br/></ul></div><div id=\"tab2\"><p><center><a class=\"thickbox\" href="+image+"><img src="+ image+" width=\"220\" height=\"140\"></a></center></p>";
var icon = customIcons[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
title: ""+nom_site+"",
shadow: icon.shadow
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
$(".tabs").tabs();
tb_init('a.thickbox');
});
} |
Partager