var address = null; 
var map	= null; /* Instance of Google Maps object */
var geocoder = null; /* Instance of Google Deocoder object */
var map_compatible = false; /* Whether or not user's browser is compatible to show the map */

/* Check if the browser is compatible */
if( GBrowserIsCompatible() ) {
	map_compatible = true;
}

/* Initialize the map this will be called when the document is loaded from: <body onLoad="initialize_map();"> */
function initialize_map() {   
	if( map_compatible ) {
        // alert(address);
		map = new GMap2(document.getElementById('map'));        
		geocoder = new GClientGeocoder();
		show_address(address);
		
		/* This displays the zoom controls for the map. If you don't want them just delete the line */
		map.addControl(new GLargeMapControl());
		
		/* This displays the map type. If you don't want that feature then just delete this */
		map.addControl(new GMapTypeControl());
		
	}
}

/* This function will move the map and shows the address passed to it */
function show_address(address) {
	if( map_compatible && geocoder ) {	
		geocoder.getLatLng(
		address,
		function( point ) 
		{
			if( !point ) 
			{
                document.getElementById('map').style.display = 'none';
				// alert('Sorry! Map information is not available for this address.');
			} else {
				map.setCenter(point, 15);
				var marker = new GMarker(point);
				map.addOverlay(marker);
				// marker.openInfoWindowHtml(address);
			}
		}
		);
	}
	return false;
}