    var map;
    
    var sortieparis= new GGeoXml("http://caenalekhine.fr/media/sortieparis.kml");
    var sortieCHU=new GGeoXml("http://caenalekhine.fr/media/sortiecherbourgCHU.kml");
    
    var lemonnier=new GLatLng(49.192614, -0.35006); 
    var parking=new GLatLng(49.193624,-0.349073);
    var pointCHU=new GLatLng(49.200018,-0.346649);
    var pointparis=new  GLatLng(49.194634,-0.3368);
    var markerparis;
    var markerCHU;
    function load() {
        
        if (GBrowserIsCompatible()) { 
	       map = new GMap2(document.getElementById("map"));
	       map.addControl(new GLargeMapControl());
	       map.addControl(new GMapTypeControl());
	       map.setCenter(lemonnier,15);
      GEvent.addListener(map,"click", function(){
            map.returnToSavedPosition();
        });
        
         
      var iconept=icone_point();
      var markerparking=createMarker(parking,"<b>Entree parking</b>",iconept);
      var markerlemonnier=createMarker(lemonnier,"<b>Institut Lemonnier</b>");
      markerparis=createMarker(pointparis,"<b>Sortie</b>",iconept);
      markerCHU=createMarker(pointCHU,"<b>Sortie</b>",iconept);
     
      sortieparis= new GGeoXml("http://caenalekhine.fr/media/sortieparis.kml");
	  sortieCHU=new GGeoXml("http://caenalekhine.fr/media/sortiecherbourgCHU.kml");
      map.addOverlay(markerlemonnier);
      map.addOverlay(markerCHU);
      map.addOverlay(markerparis);
      map.addOverlay(markerparking);
      
     markerCHU.hide();
     markerparis.hide();
    }
     function createMarker(point,message,icone) {
            if (!icone)
                var marker = new GMarker(point);
                //new GMarker(point,{ draggable: true}) pratique pour trouver les points
            else{
                var marker = new GMarker(point,{icon: icone});
                
            }
            GEvent.addListener(marker, "mouseover", function() {
            if(map.getZoom()<16){
              map.savePosition();
              map.setZoom(16);}
              map.openInfoWindowHtml(point, message);
            });
            //un callback utilitaire pour trouver les points
            // GEvent.addListener(marker, "dragend", function() {
            //               
            //               map.openInfoWindowHtml(point, marker.getLatLng().toUrlValue());
            //             });
            return marker;
        }
    }	
    
    function  icone_point(){
         var iconepoint=new GIcon(G_DEFAULT_ICON, "images/node.gif");
        iconepoint.iconSize = new GSize(32, 32); 
        iconepoint.iconAnchor=new GPoint(16,16);
        iconepoint.infoWindowAnchor=new GPoint(16,16);
        return iconepoint;
    }
        
    function itineraire_Paris(){
        map.removeOverlay(sortieCHU);
        map.addOverlay(sortieparis);
        markerCHU.hide();
        markerparis.show();
        map.setCenter(new GLatLng(49.19326,-0.343151),15);
     }
     
    function itineraire_CHU(){
        map.removeOverlay(sortieparis);
        markerparis.hide();
        markerCHU.show();
		
        map.addOverlay(sortieCHU);
        map.setCenter(new GLatLng(49.196586,-0.344868),15);
     }
     
    function sallejeu () {
        map.removeOverlay(sortieparis)
        map.removeOverlay(sortieCHU);
        markerCHU.hide();
        markerparis.hide();
        map.setCenter(lemonnier);
     }
     
         