    //<![CDATA[
    var map = null;
    var geocoder = null;

    function load(lat, lon, address) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        var center = new GLatLng(lat, lon);
        map.addControl (new GLargeMapControl());
        map.addControl(new GMapTypeControl());
		map.setCenter(center, 13);
        geocoder = new GClientGeocoder();
        
        if (address != undefined) {
        	showAddress(address);
        } 
		
		GEvent.addListener(map, "click", function(marker, point) {
		 if(marker) {
		    map.removeOverlay(marker);
		    map.closeInfoWindow();
		  } else {dragMarker(point)}
		});
      }
    }
    function dragMarker(point) {
    	
    	var marker = new GMarker(point, {draggable: true});
 				GEvent.addListener(marker, "dragend", function() {
				  var punto = marker.getPoint();
				  marker.openInfoWindowHtml("<h2>GPS Position</h2>LON: " + punto.lng() + "<br>LAT: " + punto.lat());
				  });				
		  map.addOverlay(marker);
		  var center = map.getCenter();		
          marker.openInfoWindowHtml("<h2>GPS Position</h2>LON: " + center.lng() + "<br>LAT: " + center.lat());
		  GEvent.addListener(map, "dblclick", function(marker, point) {
		  map.removeOverlay(marker);
		});    	
    }
    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              // var marker = new GMarker(point);
              
            dragMarker(point)                 
            }
          }
        );
      }
    }
    //]]>