1 |
aurelien |
1 |
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBQH9AL26AfEfaraxwo1G6_adyVjPRRQE4Gx2u7MomK9DJWf9kMLJ9y-ZA"
|
|
|
2 |
type="text/javascript"></script>
|
|
|
3 |
<script type="text/javascript">
|
|
|
4 |
|
|
|
5 |
//<![CDATA[
|
|
|
6 |
var latFr = 47;
|
|
|
7 |
var lonFr = 1.7;
|
|
|
8 |
|
|
|
9 |
var latFrMin = 34;
|
|
|
10 |
var latFrMax = 58;
|
|
|
11 |
var lonFrMin = -12;
|
|
|
12 |
var lonFrMax = 15;
|
|
|
13 |
|
|
|
14 |
function load() {
|
|
|
15 |
if (GBrowserIsCompatible()) {
|
|
|
16 |
var map = new GMap2(document.getElementById("map"));
|
|
|
17 |
map.setCenter(new GLatLng(latFr, lonFr), 6);
|
|
|
18 |
map.addControl(new GSmallMapControl());
|
|
|
19 |
map.addControl(new GMapTypeControl());
|
|
|
20 |
map.setMapType(GMapType.G_SATELLITE_MAP);
|
|
|
21 |
//map.addControl(new GSmallZoomControl());
|
|
|
22 |
// window.setTimeout(function() {
|
|
|
23 |
GEvent.addListener(map, "moveend", function() {
|
|
|
24 |
var bounds = map.getBounds();
|
|
|
25 |
var southWest = bounds.getSouthWest();
|
|
|
26 |
var northEast = bounds.getNorthEast();
|
|
|
27 |
if (southWest.lng()<lonFrMin || southWest.lat()<latFrMin
|
|
|
28 |
|| northEast.lng()>lonFrMax || northEast.lat()>latFrMax)
|
|
|
29 |
map.returnToSavedPosition();
|
|
|
30 |
else
|
|
|
31 |
map.savePosition();
|
|
|
32 |
}, 20);
|
|
|
33 |
|
|
|
34 |
// Creates a marker at the given point with the given number label
|
|
|
35 |
function createMarker(point, text, text2) {
|
|
|
36 |
var marker = new GMarker(point);
|
|
|
37 |
var html = "<b>" + text + "</b> participants inscrits à " + text2;
|
|
|
38 |
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
|
|
|
39 |
return marker;
|
|
|
40 |
}
|
|
|
41 |
//on va poser les points des villes
|
|
|
42 |
<? while ($participants = mysql_fetch_row($req_participants)) { ?>
|
|
|
43 |
var point = new GLatLng(<?= $participants[1] ?>, <?= $participants[2] ?>);
|
|
|
44 |
map.addOverlay(createMarker(point, "<?= $participants[0] ?>", "<?= $participants[3] ?>"));
|
|
|
45 |
<? } ?>
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
//]]>
|
|
|
52 |
</script>
|