/* --- Google map / Start ----------------------------------------------------------------------- */

/**
 * Generates a Google map
 *
 * @version 	03/11/09
 * @autor		Tobias Preuss
 * @see 		contact_directions.php, global_frame_o2009.php
 */
  
if ( GBrowserIsCompatible()) {
	var googleMap;
	var googleMapDirections;
}
// Updates map with given address coordinates
function googleMapShowAddress() {
	var center = new GLatLng(37.787683, -122.397196);
	googleMap.setCenter( center, 16);
	googleMap.openInfoWindowHtml( center, "<div style='text-align:center;color:#000;font-size:1.3em;'>Olive Media Products, Inc.<br/>San Francisco</div>", {
		maxHeight: 40,
		maxWidth: 80
	});
}
// Updates directions with the given FROM address
function googleMapUpdateDirections( loc) {
	if ( loc != "") googleMapDirections.load( loc + ' to 555 Howard street, San Francisco, CA 94105');
}
// Inits map
function googleMapInitialize() {
	googleMap = new GMap2( document.getElementById( "google_map_canvas"));
	googleMap.addControl( new GSmallZoomControl());
	
	var googleMapDirContainer = document.getElementById( 'google_map_directions');
	googleMapDirections = new GDirections( googleMap, googleMapDirContainer);
	GEvent.addListener( googleMapDirections, "error", function(x){
		alert( 'Please enter a valid address.');
	});
	googleMapDirections.load( 'San Francisco Airport, CA to 555 Howard street, San Francisco, CA 94105');
}

/* --- Google map / End ------------------------------------------------------------------------- */