function load() {
if (GBrowserIsCompatible()) { 
      // A function to create the marker and set up the event window
      // Dont try to unroll this function. It has to be here for the function closure
      // Each instance of the function preserves the contends of a different instance
      // of the "marker" and "html" variables which will be needed later when the event triggers.    


       var baseIcon = new GIcon();
          baseIcon.iconSize=new GSize(32,32);
          baseIcon.shadowSize=new GSize(56,32);
          baseIcon.iconAnchor=new GPoint(16,32);
          baseIcon.infoWindowAnchor=new GPoint(16,0);

       var patrimoine = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-patrimoine.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    
       var pointdevue = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-point-de-vue.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");
       var lavoir = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-lavoir.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");
       var moulin= new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-moulin.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    
       var bdloisirs = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-base-de-loisirs.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    
       var musee = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-musee.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    
       var maison = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-maison-de-lail.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    
       var pigeonnier = new GIcon(baseIcon, "http://www.tourisme-coeurdelomagne.fr/images/picto-pigeonnier.png", null, "http://maps.google.com/mapfiles/kml/pal3/icon21s.png");    



      function createMarker(point,html,icon) {
        var marker = new GMarker(point,icon);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }



      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(43.897830543638634,0.7587432861328125),14);

       // Set up three markers with info windows 
    
      var point = new GLatLng(43.891374845095825,0.7697618007659912);
      var marker = createMarker(point,'<div style="width:240px">L\'église du XIXème siècle</div>', patrimoine)
      map.addOverlay(marker);
      
      var point = new GLatLng(43.89073310268918,0.7698154449462891);
      var marker = createMarker(point,'<div style="width:240px">La vieille église</div>', patrimoine)
      map.addOverlay(marker);
      
      var point = new GLatLng(43.89216734876631,0.7704752683639526);
      var marker = createMarker(point,'<div style="width:240px">La halle</div>', patrimoine)
      map.addOverlay(marker);

      var point = new GLatLng(43.89169571370609,0.7725834846496582);
      var marker = createMarker(point,'<div style="width:240px">Point de vue</div>', pointdevue)
      map.addOverlay(marker);

      var point = new GLatLng(43.88958877376976,0.770915150642395);
      var marker = createMarker(point,'<div style="width:240px">Le lavoir</div>', lavoir)
      map.addOverlay(marker);

      var point = new GLatLng(43.902430285035926,0.7379293441772461);
      var marker = createMarker(point,'<div style="width:240px">Le moulin de Rochegude</div>', moulin)
      map.addOverlay(marker);

      var point = new GLatLng(43.910446127802906,0.7574343681335449);
      var marker = createMarker(point,'<div style="width:240px">La base de loisirs</div>', bdloisirs)
      map.addOverlay(marker);

      var point = new GLatLng(43.89100371780019,0.7683080434799194);
      var marker = createMarker(point,'<div style="width:240px">Le Musée de l\'école publique</div>', musee)
      map.addOverlay(marker);

      var point = new GLatLng(43.889913517994756,0.7467484474182129);
      var marker = createMarker(point,'<div style="width:240px">La Maison de l\'ail</div>', maison)
      map.addOverlay(marker);

      var point = new GLatLng(43.88942253496942,0.747944712638855);
      var marker = createMarker(point,'<div style="width:240px">Pigeonnier</div>', pigeonnier)
      map.addOverlay(marker);

      var point = new GLatLng(43.89402292586231,0.7453697919845581);
      var marker = createMarker(point,'<div style="width:240px">Pigeonnier</div>', pigeonnier)
      map.addOverlay(marker);
    }
    
    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
}

window.onload=load;
window.onunload=GUnload; 
