	var geocoder;
	var map;
	var centre; // déclaration globale
    function load()
	{
		if (GBrowserIsCompatible())
		{
			map = new GMap2(document.getElementById("map"));
			map.setMapType(G_NORMAL_MAP);
			map.addMapType(G_PHYSICAL_MAP);
			var mapControl = new GHierarchicalMapTypeControl();
			mapControl.clearRelationships();
			mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Libellés (Carte hybride)", false);
			map.addControl(mapControl);

			geocoder = new GClientGeocoder();

			map.addControl(new GLargeMapControl3D());
			map.enableContinuousZoom();

			geocode("16200 SIGOGNE, France");
			
      }
    }
	function createMarker(point,position,html) 
	{
		var marker = new GMarker(point);
		return marker;
	}
	function geocode(address) {
		  geocoder.getLatLng(
		    address,
		    function(point) {
		      if (!point) {
		        alert(address + " not found");
		      } else {
		        map.setCenter(point,14);
		        var marker = createMarker(point, address);
		        map.addOverlay(marker);
		      }
		    }
		  );
		  
		  return false;
	}

	function map_enlarge()
	{
		document.getElementById("map").style.height=600+"px";
		document.getElementById("map_enlarge").style.display="none";
		document.getElementById("map_reduce").style.display="block";
		centre = map.getCenter();
		map.checkResize();
		refreshmove();
	}
        
	function map_reduce() {
		document.getElementById("map").style.height=300+"px";
		document.getElementById("map_enlarge").style.display="block";
		document.getElementById("map_reduce").style.display="none";
		map.checkResize();

		refreshmove()
	}
  
	function refreshmove()
	{
		map.panTo(centre);
	}	
	
	window.onload = function(){ load();}
	window.onunload=function(){ GUnload();}
