// JavaScript Document
//Date: 20100118
//Author: JD
//Description: JS file for manipulating Google maps objects


  
	
	var myPano;
	var map;
	var directions;
	var infoWindow;
	
	function showTraffic()  
	{
		map.addOverlay(new GTrafficOverlay());
		map.setCenter(new GLatLng(51.5178586, -0.1447947), 8);
		map.getInfoWindow().hide();
	}
	
	function getdirections()
	{
		infoWindow.hide();
		if (directions != null)
			directions.clear();
			
		var userVal = document.getElementById('directionsText');
		var directionsDiv = document.getElementById('directionsDiv');
		
		if (directionsDiv != null)
	    	directions = new GDirections(map, directionsDiv);
		else
			directions = new GDirections(map);
		
		GEvent.addListener(directions,"load", function() 
		{
			var summary= document.getElementById('mapSummary');
			summary.innerHTML = 'From <b>' + userVal.value.toUpperCase() + '</b> to <b>Chandos House</b> its ' + directions.getSummaryHtml() + ' by car. The route is shown on the map above.';		
			document.getElementById('printDirections').style.visibility = 'visible';
		});
		
		directions.load("from: " + userVal.value + " to: 51.5184186,-0.1450947", {getSteps:true}); 
	}
	
	
	
	
	function initialize() { 
	if (GBrowserIsCompatible())  
	{        
	
		var mapElement = document.getElementById("map_canvas");
		
		if (mapElement != null)
		{
			document.getElementById("noscript").style.visibility = "hidden";
			map = new GMap2(document.getElementById("map_canvas"));  
			map.setCenter(new GLatLng(51.5184186, -0.1450947), 15);        			
			var lat1 = new GLatLng(51.5184186, -0.1450947);
			marker = new GMarker(lat1);    
			map.addOverlay(marker); 
			map.openInfoWindowHtml(map.getCenter(), 
			"<table><tr><td>Chandos House<br/>2 Queen Anne Street<br/>London<br/>W1G 9LQ<br/>020 7290 3820</td>" +
			"<td style='padding-left:20px;'><img src='SiteImages/Maps/pic1lg.jpg' width='70px' height='70px'/></td></tr></table>", 
			{pixelOffset: new GSize(3,-5)} );
			infoWindow = map.getInfoWindow();
						
			var mapControl = new GHierarchicalMapTypeControl();
			map.addControl(mapControl); 
			map.addControl(new GOverviewMapControl());
			map.setUIToDefault(); 
		}
		
		
	}    

	}    
	

