// pour afficher les cartes Google

function chargeCarte() {

    if (GBrowserIsCompatible()) {

        // vues dispos : G_NORMAL_MAP, G_PHYSICAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP

        var map = new GMap2(document.getElementById(dividmap), {mapTypes:[G_NORMAL_MAP,G_PHYSICAL_MAP]});

        var centre = new GLatLng(latitude, longitude); // fixe le centre
        map.setCenter(centre, echelle, G_NORMAL_MAP);  // avec présentation normale

        map.addControl(new GSmallMapControl());        // joystick et +/-
        map.addControl(new GMapTypeControl());         // type de carte
        //map.addControl(new GSmallZoomControl());     // juste +/-
        //map.addControl(new GLargeMapControl());      // joystick et curseur zoom
        //map.addControl(new GOverviewMapControl());   // aperçu en bas
        //map.addControl(new GScaleControl());         // échelle

        //map.enableScrollWheelZoom();                 // zoom avec la souris
        map.enableContinuousZoom();                    // zoom fin
        
        map.setMapType(presentation);                  // fixe le type de présentation choisie

        var ovcontrol = new GOverviewMapControl(new GSize(100,100));
        map.addControl(ovcontrol,new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10)));

        var geoXml = new GGeoXml(kmlfile);
        map.addOverlay(geoXml);

        var point = new GLatLng(latitude, longitude);   // point pour éviter avertissement js

        if(vwcoord) { // fonction pour afficher les coordonnées aux administrateurs

            GEvent.addListener(map, "click", function(overlay, point) {
              var decPlaces = 6;
              var centreclic = map.getCenter();
              alert("Clic :\n¯¯¯¯\n" +
                    "Latitude = " + parseFloat(point.lat()).toFixed(decPlaces) + "\n" +
                    "Longitude = " + parseFloat(point.lng()).toFixed(decPlaces) + "\n\n" +
                    "Centre :\n¯¯¯¯¯¯\n"+
                    "Latitude = " + parseFloat(centreclic.lat()).toFixed(decPlaces) + "\n" +
                    "Longitude = " + parseFloat(centreclic.lng()).toFixed(decPlaces) + "\n\n" +
                    "Echelle = " + map.getZoom() + "\n¯¯¯¯¯¯\n\n\n");
            });
        }
    }
}

