var map=null;
var geocoder=null;

function load() {
	if (GBrowserIsCompatible()) {
		map=new GMap2(document.getElementById("map"));
		geocoder=new GClientGeocoder();
		map.setCenter(new GLatLng(41.90,12.49),5);
		map.addControl(new GMapTypeControl());
		map.addControl(new GLargeMapControl());
	}
}

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

function showAddress(address) {
	geocoder.getLatLng(address,function(point) {
		if (!point) {
			alert(address+" non trovato!");
		} 
		else {
			map.setCenter(point,10);
			map.addOverlay(createMarker(point,address));
		}
	});
}