    //<![CDATA[
	
	    var iconCollectif = new GIcon(); 
    iconCollectif.image = '../template/images/programmes/maps/icone-collectif.png';
    iconCollectif.shadow = '../template/images/programmes/maps/ico_collectif_ombre.png';
    iconCollectif.iconSize = new GSize(30, 32);
    iconCollectif.shadowSize = new GSize(40, 32);
    iconCollectif.iconAnchor = new GPoint(6, 32);
    iconCollectif.infoWindowAnchor = new GPoint(5, 1);

    var iconVilla = new GIcon(); 
    iconVilla.image = '../template/images/programmes/maps/icone-villa.png';
    iconVilla.shadow = '../template/images/programmes/maps/ico_villa_ombre.png';
    iconVilla.iconSize = new GSize(30, 30);
    iconVilla.shadowSize = new GSize(40, 30);
    iconVilla.iconAnchor = new GPoint(6, 30);
    iconVilla.infoWindowAnchor = new GPoint(5, 1);
	
	    var iconTerrain = new GIcon(); 
    iconTerrain.image = '../template/images/programmes/maps/icone-terrain.png';
    iconTerrain.shadow = '../template/images/programmes/maps/ico_terrain_ombre.png';
    iconTerrain.iconSize = new GSize(30, 30);
    iconTerrain.shadowSize = new GSize(40, 30);
    iconTerrain.iconAnchor = new GPoint(6, 30);
    iconTerrain.infoWindowAnchor = new GPoint(5, 1);

    var customIcons = [];
    customIcons["1"] = iconCollectif;
    customIcons["2"] = iconVilla;
    customIcons["3"] = iconTerrain;
	
	var iconsType = [];
	iconsType["1"] = "collectif";
    iconsType["2"] = "villa";
    iconsType["3"] = "terrain";
	

function load() {
	
	// ===== Objet GLatLngBounds - sorte de rectangle virtuel pour définir une zone d'affichage =====     
      var bounds = new GLatLngBounds();

	
      if (GBrowserIsCompatible()) {
	  
        var map = new GMap2(document.getElementById("map"));

		var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,40));
		map.addControl(new GLargeMapControl(), topRight);
        map.addControl(new GMapTypeControl());

		map.addMapType(G_PHYSICAL_MAP);
		map.removeMapType(G_SATELLITE_MAP);
		map.removeMapType(G_HYBRID_MAP);
		map.setMapType(G_PHYSICAL_MAP);
		
//        map.enableScrollWheelZoom();

//        map.setCenter(new GLatLng(0,0), 0);

        var toulouse = map.setCenter(new GLatLng(43.599289,1.343078), 10);
		
			
		GDownloadUrl("genxml_all.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
			
			var idMarker = markers[i].getAttribute("idmarker");
			var name = markers[i].getAttribute("name");
            var address = markers[i].getAttribute("address");
            var type = markers[i].getAttribute("type");
			var urlprog = markers[i].getAttribute("url");
			
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            var marker = createMarker(point, idMarker, name, address, type, urlprog);
			map.addOverlay(marker);
			 // ====Chaque fois qu'un point est trouvé, étendre les bordures du rectangle afin de l'inclure =====
        if (markers.length!=0) {
		bounds.extend(point);
		}
          }
		  if (markers.length>1) {
		  // ===== determine le niveau de zoom depuis bounds =====
          map.setZoom(map.getBoundsZoomLevel(bounds)-1);
          // ===== determine le centre depuis bounds ======
          map.setCenter(bounds.getCenter());
		  }
		  else {
			map.setCenter(toulouse);  
		  }

        });
		

      }
    }

	
	
function createMarker(point, id, name, address, type, url) {
      var marker = new GMarker(point, {icon:customIcons[type], title:name + " - " + address });
      GEvent.addListener(marker, 'click', function() {
       document.location.href= url + ".php";
      });
      return marker;
    }	
    //]]>

