/**
 * JavaScript support for the main world enough map 
 * (c) Simon Brooke 2007
 *
 * $Revision: 1.7 $
 *
 */

/*
 * $Log$
 */

/**
 */
function setHome( lat, lon)
{
	setCookie( "coords_lat", lat, 30);
	setCookie( "coords_long", lon, 30);
	alert( "Your new start location has been set");
}


/**
 * Called on page load to instantiate the map in the first place.
 * return the map object.
 */
function setupMap( withcontrols)
{
	var map = null;

	if (GBrowserIsCompatible()) 
    {
    	map = new GMap2(document.getElementById("mapdiv"));
    	
    	if ( withcontrols == true)
    	{
        	map.addControl( new GLargeMapControl());
        	map.addControl( new GMapTypeControl());    
        	map.addControl( new GScaleControl());    
        }
        
	    map.setCenter(new GLatLng( 55, -4), 8);
	    map.setMapType( G_SATELLITE_MAP);
          
		GEvent.addListener(map, "click", 
		      	function(marker, point) 
		      	{
  		  	  		if (marker) 
			  		{
			      		map.openInfoWindowHtml( marker.getPoint(), marker.content);
  		    	  	} 
		      	});

	}
    else
    {
    	alert( "We're sorry, but your browser is not supported by Google Maps");
    }
    
    return map;
}
