window.onload = function() { 
    document.getElementById("loader").style.display = "none";
    document.getElementById("map_canvas").style.display = "";
    document.getElementById("directions").style.display = "";
    document.getElementById("btnSearch").style.display = "";
}

    var map;
	var gdir;
	var geocoder = null;
	var addressMarker;
	document.getElementById("btnSearch").style.display = "none";
	
	function initialize() {
	    
		if (GBrowserIsCompatible()) {      
			map = new GMap2(document.getElementById("map_canvas"));
			gdir = new GDirections(map, document.getElementById("directions"));
			
			var geocoder = new GClientGeocoder();
			var address = "Sao Paulo";
			
			geocoder.getLatLng(
				address,
				function(point) {
				  if (!point) {
					alert(address + " not found");
				  } else {
					map.setCenter(point, 13);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					//marker.openInfoWindowHtml(address);
				  }
				}
			  );
			  
			document.getElementById("map_canvas").style.display = "none";
	        document.getElementById("directions").style.display = "none";
		}
	}
	
	function setDirections(fromAddress, toAddress, locale) {
		gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
	}
	initialize();