//Javascript file for google maps


//<![CDATA[
function loadMap() {
    	
      //Check if browser is ok
      if (GBrowserIsCompatible()) {


      	//Set map to Div
        var map = new GMap2(document.getElementById("mapCanvas"));
        
        
        //Set default UI
        map.setUIToDefault();
        
        
        //Declare the custom icons:
		var blueIcon = new GIcon(G_DEFAULT_ICON);			//Blue for parking
		blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
		blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		blueIcon.iconSize = new GSize(32, 32);
		blueIcon.shadowSize = new GSize(34, 37);
		blueIcon.iconAnchor = new GPoint(0, 0);
		icoParking = { icon:blueIcon };
		
		var greenIcon = new GIcon(G_DEFAULT_ICON);					//Green for bus stops
		greenIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png";
		greenIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		greenIcon.iconSize = new GSize(32, 32);
		greenIcon.shadowSize = new GSize(34, 37);
        icoBus = { icon:greenIcon };
        
        
        //Set markers
		var mrkHotel = new GMarker(new GLatLng(50.374215,-4.180266));
		var mrkBusGranby = new GMarker(new GLatLng(50.374828,-4.177263), icoBus);
		var mrkPark = new GMarker(new GLatLng(50.374020,-4.17978), icoParking);
		
		
		
		//Marker events
		GEvent.addListener(mrkHotel, "click", function() {			//The Crown
    		mrkHotel.openInfoWindowHtml("<p><b>The Royal Fleet Hotel</b><br />Devonport, Plymouth</p>");
 		 });
 		 
 		 GEvent.addListener(mrkPark, "click", function() {			//Car Park
    		mrkPark.openInfoWindowHtml("<p><b>Morice Street Car Park</b></p>");
 		 });
 		 
 		 GEvent.addListener(mrkBusGranby, "click", function() {			//Alexandra Road
    		mrkBusGranby.openInfoWindowHtml("<p><b>St Aubyn Road</b><br /><b class=\"red\">Citybus:</b> 26, 34, 45/A, 46/A, 47/A<br /><b class=\"blue\">First:</b> 3</p>");
 		 });
 		 
 		 
		//Set map central point
        map.setCenter(new GLatLng(50.374215,-4.180266), 16);

		//Apply the markers
		map.addOverlay(mrkHotel);
		map.addOverlay(mrkBusGranby);
		map.addOverlay(mrkPark);
      }
}

function testLoad(){
	alert("Hello!");
	 if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("mapCanvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();
      }
}