// JavaScript Document

function initMap()
{
	if (GBrowserIsCompatible())
	{
		var map = new GMap2(document.getElementById("map"));

		// add controls to the map
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.enableContinuousZoom();
		map.enableDoubleClickZoom();

		// center the map on Sister Ray
		map.setCenter(new GLatLng(51.5145, -0.1355), 15);

		// create an icon object for the office marker
		var icon = new GIcon();
		icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
		icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		icon.iconSize = new GSize(12, 20);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);

		var office = new GLatLng(51.5145, -0.1355);
		var office_details='';
		office_details += '<p class="first"><strong>Sister Ray Ltd.</strong><br />34-35 Berwick Street<br />London<br />W1F 8RP</p></div>';
		office_details += '<p><small>Get directions <a href="http://maps.google.co.uk/maps?daddr=W1F+8RP&saddr=&f=li&hl=en&layer=&ie=UTF8&z=16&om=1&iwloc=addr" target="_blank">to here</a> ';
		office_details += 'or <a href="http://maps.google.co.uk/maps?saddr=W1F+8RP&daddr=&f=li&hl=en&layer=&ie=UTF8&z=16&om=1&iwloc=addr" target="_blank">from here</a></small</p>';
		map.addOverlay(createMarker(icon, office, office_details));
		
//		addDirections(map, icon);
	}
}
addOnLoad(initMap);

function createMarker(icon, point, text)
{
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(text);
	});
	return marker;
}


