
var map = null;
var geocoder = null;
var address = null;
//var address = 'sydney,nsw, australia';

function loadGoogleMap(customAddress){
 address = customAddress;
 if (GBrowserIsCompatible()){
	var mapContainer = document.getElementById("map");
	showHideMap(true);
	map = new GMap2(mapContainer);
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	geocoder = new GClientGeocoder();
  }
  showAddress(address);
  //map.setMapType(G_SATELLITE_TYPE);
}

function showAddress(address) {
  if (geocoder) {
	geocoder.getLatLng(
	  address,
	  function(point) {
		if (!point) {
		  alert(address + " not found");
		} else {
		  map.setCenter(point, 13);
		}
	  }
	)
  }
}

function showHideMap(bln){
	var mapContainer = document.getElementById("map");
	if(bln){
		mapContainer.style.visibility = 'visible';
	}
	else{
		mapContainer.style.visibility = 'hidden';
		//GUnload();
	}	
}

