var geocoder;
function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(46.85, 1.75), 6);
		geocoder = new GClientGeocoder();
	}
	else {
		alert("Desole, l'API Google Maps n'est pas compatible avec votre navigateur.");
	}
}

var map;
    var geocoder;

    function createMarker(point,html) {
      var marker = new GMarker(point);
      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;
    }

function geocode(address) {
	geocoder.getLatLng( address, function(point) {
	if (!point) {
		alert(address + " introuvable");
	}
	else {
		map.setCenter(point, 13);
		var marker = createMarker(point, address);
		map.addOverlay(marker);
		marker.openInfoWindowHtml(address);
	}
	}
		);
		return false;
}
