/* Load Google Map for Shop */
function LoadGoogleMap( latitude, longitude, directions ) 
{
	/* Check to make sure we do not have any blank values */
	if ( latitude != "" && longitude != "")
	{
		/* Check to make sure we have a compatable browser */
		if ( GBrowserIsCompatible() ) 
		{
			var map = new GMap2(document.getElementById("map"));
        	map.addControl(new GMapTypeControl());
        	map.addControl(new GLargeMapControl());
        	map.enableDoubleClickZoom();
        	map.setCenter(new GLatLng( latitude, longitude), 13);
			
			// Add markers to the map
			var point = new GLatLng( latitude, longitude );
			map.addOverlay( CreateMarker(point, 1, directions ));
		}
		else
		{
			/* Show a simple error if the browser is incompatable with Google Maps */
			document.getElementById('map').innerHTML = "<img src='images/google_maps/google_map_place_holder.gif' width='534' height='341' alt='No map available' title='No map available' />";
		}
	}	
}

// Creates a marker at the given point with the given number label
function CreateMarker(point, number, directions ) {

	// Create our "tiny" marker icon
	var icon = new GIcon();
	icon.image = "images/google_maps/map_pin.gif";
	icon.iconSize = new GSize(40, 40);
	icon.iconAnchor = new GPoint( 20, 20 );
	icon.infoWindowAnchor = new GPoint( 20, 20);
	
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml( directions );
	});
	
	return marker;
}


