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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
<html>
<head>
<title>Organiser une réunion</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAA70FDjbuxl9DIRqEfZN9IRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSNNUqIsSPkke4swap67gHzSSuiYA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
// Create a special marker for the base location
function createBase(addressBase){
var geocoder = new GClientGeocoder();
geocoder.getLatLng(addressBase,
function(point) {
if (!point) {
alert(addressBase + " not found");
} else {
map.setCenter(point, 10);
var tinyIcon = new GIcon(G_DEFAULT_ICON);
tinyIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
tinyIcon.iconSize = new GSize(32, 32);
markerOptions = { icon:tinyIcon };
var marker = new GMarker(point, markerOptions);
//alert(point);
GEvent.addListener(marker, "click", function() {
var myHtml = "<b><i> You </i></b>";
map.openInfoWindowHtml(point, myHtml);
});
map.addOverlay(marker);
}
}
);
}
// Creates a marker at the given point with the given name and firstname
function createMarker(address, name, firstname) {
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
var myHtml = "<i>" + name + " " + firstname + "</i>";
map.openInfoWindowHtml(point, myHtml);
});
map.addOverlay(marker);
}
}
);
}
GDownloadUrl("data.xml", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var base = parseFloat(markers[i].getAttribute("base"));
var address = markers[i].getAttribute("address");
if(base == 1){
createBase(address);
} else {
var name = markers[i].getAttribute("name");
var firstname = markers[i].getAttribute("firstname");
createMarker(address, name, firstname);
}
}
});
}
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 800px; height:600px;"></div>
</body>
</html> |
Partager