    var map = "";

	function showHide(thisShow, thisHide, thisTab){

	document.getElementById(thisShow).className = "";
	document.getElementById(thisHide).className = "hidden";

	//alert(document.getElementById(thisShow).style.display);
	
	document.getElementById("sideBarTab_1").className = "";
	document.getElementById("sideBarTab_2").className = "";
	
	document.getElementById(thisTab).className = "current";
	
	return false;
	
	}
	
    function clearSearch(thisBox, value)
	{
	    if(thisBox.value ==(value))
	    {
            thisBox.value = ("");	    
	    }

	}
	
	function setSearch(thisBox, value)
	{
		if(thisBox.value == (""))
	    {
            thisBox.value = value;
	    }
	}

	var refreshCount = 0;
	
	// Plots a basic location from a postcode
	



	
	function placeMarkerAtPoint(point)
	{
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GOverviewMapControl());
		map.enableDoubleClickZoom();
					
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<h2>Substudio Ltd</h2><p>8 Hill Street, Romiley, Stockport<br />Cheshire, SK6 3AH");
		});					
		map.setCenter(point, 12);
		map.addOverlay(marker);
	}	
	
	// Creates a basic point and plots on the map
	
	function officeMapKml()
	{
		
		//var geoXml = new GGeoXml("http://www.substudio.co.uk/maps/mapdata.xml");

		//map = new GMap2(document.getElementById("map"));
		//map.addControl(new GSmallMapControl());
		//map.addControl(new GOverviewMapControl());
		//map.enableDoubleClickZoom();
					
		//var point = new GLatLng(53.41430252851378,-2.091425657272341);
		//map.setCenter(point, 12);
		//map.addOverlay(geoXml);

	}
	
	function officeMap()
	{
		
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GOverviewMapControl());
		map.enableDoubleClickZoom();
					
		var point = new GLatLng(53.482855,-2.236147);
		map.setCenter(point, 16);
		
		var marker = new GMarker(point);
		
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<p>NOTE</p><p>G1 Smithfield Building, 34 Tib Street<br />Manchester, M4 1LA");
		});			
		
		map.addOverlay(marker);
		
		//map.addOverlay(geoXml);

	}
	
	// Style Sheet Switchers
	
		function setActiveStyleSheet(title, doTicker) {
		  var i, a, main;
		  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			  a.disabled = true;
			  if(a.getAttribute("title") == title) a.disabled = false;
			}
		  }
		
		if(doTicker)
		{
			thisNewsTicker.initialize();
		}
		
		}
		
		function getActiveStyleSheet() {
		  var i, a;
		  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
		  }
		  return null;
		}
		
		function getPreferredStyleSheet() {
		  var i, a;
		  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1
			   && a.getAttribute("rel").indexOf("alt") == -1
			   && a.getAttribute("title")
			   ) return a.getAttribute("title");
		  }
		  return null;
		}
		
		function createCookie(name,value,days) {
		  if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		  }
		  else expires = "";
		  document.cookie = name+"="+value+expires+"; path=/";
		}
		
		function readCookie(name) {
		  var nameEQ = name + "=";
		  var ca = document.cookie.split(';');
		  for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		  }
		  return null;
		}
		
		window.onload = function(e) {
		  var cookie = readCookie("style");
		  var title = cookie ? cookie : getPreferredStyleSheet();
		  setActiveStyleSheet(title, false);
		}
		
		window.onunload = function(e) {
		  var title = getActiveStyleSheet();
		  createCookie("style", title, 365);
		}
		
		var cookie = readCookie("style");
		var title = cookie ? cookie : getPreferredStyleSheet();
		setActiveStyleSheet(title);



	// This doesn't work
	
	function showAddress(address) {
		
		var map = new GMap2(document.getElementById("map"));
		var geocoder = new GClientGeocoder();

	  geocoder.getLatLng(
		address,
		function(point) {
		  if (!point) {
			alert(address + " not found");
		  } else {
			map.setCenter(point, 13);
			var marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml(address);
		  }
		}
	  );
	}
	
	
	function FTLoadXML(thisXML)
    {
        xmlDocLoc = thisXML;
       
        if (window.ActiveXObject)
        {
            var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async="false";
            xmlDoc.loadXML(xmlDocLoc);
        
        } else {
        
        var parser=new DOMParser();
        var xmlDoc=parser.parseFromString(xmlDocLoc,"text/xml");
        
        }
        return(xmlDoc);
    }
	
    var xmlHttp
	
	function doMap()
	{
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GOverviewMapControl());
		map.enableDoubleClickZoom();
		FTgetMapData()
	}
    
    function FTgetMapData()
	{
		
		xmlHttp=GetXmlHttpObject()
		
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url="vehiclesXML.aspx";
		
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		t=setTimeout("FTgetMapData()",20000)
	} 
		
		function stateChanged() 
		{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				xmlDoc = FTLoadXML(xmlHttp.responseText);
				map.clearOverlays();
				if(xmlDoc.documentElement.childNodes.length > 0)
				{              
					for (var iNode = 0; iNode < xmlDoc.documentElement.childNodes.length; iNode++)
					{
						var thisPID = xmlDoc.documentElement.childNodes[iNode].childNodes[0].childNodes[0].nodeValue;
						var thisNme = xmlDoc.documentElement.childNodes[iNode].childNodes[1].childNodes[0].nodeValue;
						var thisLat = xmlDoc.documentElement.childNodes[iNode].childNodes[2].childNodes[0].nodeValue;
						var thisLon = xmlDoc.documentElement.childNodes[iNode].childNodes[3].childNodes[0].nodeValue;
						var thisDat = xmlDoc.documentElement.childNodes[iNode].childNodes[4].childNodes[0].nodeValue;
						var thisAdd = xmlDoc.documentElement.childNodes[iNode].childNodes[5].childNodes[0].nodeValue;
						var thisIco = xmlDoc.documentElement.childNodes[iNode].childNodes[6].childNodes[0].nodeValue;
						var thisSpe = xmlDoc.documentElement.childNodes[iNode].childNodes[7].childNodes[0].nodeValue;
						var thisUse = xmlDoc.documentElement.childNodes[iNode].childNodes[9].childNodes[0].nodeValue;
					}
		
					if (GBrowserIsCompatible())
					{
						
					var icon = new GIcon();
					icon.image = "/include/images/car.png";
					icon.iconSize = new GSize(48, 48);
					icon.iconAnchor = new GPoint(24, 24);
					icon.infoWindowAnchor = new GPoint(5, 1);
					
					var point = new GLatLng(thisLat, thisLon);
					var marker = new GMarker(point, icon);
					
					GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml("<h2>" + thisNme + "</h2><p>" + thisAdd + ", " + thisSpe + " Mph</p>");
					});					
					
					if(refreshCount == 0) { map.setCenter(point, 12); }
					
					map.addOverlay(marker);
					}
				}   
				refreshCount ++;   
			}
    	} 
		
	function GetXmlHttpObject()
    { 
        var objXMLHttp=null
        if (window.XMLHttpRequest)
        {
            objXMLHttp=new XMLHttpRequest()
        }
        else if (window.ActiveXObject)
        {
            objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
        }
        return objXMLHttp
    } 
	
		function clearSearch(thisBox, value)
	{
	    if(thisBox.value ==(value))
	    {
            thisBox.value = ("");	    
	    }

	}
	
	function setSearch(thisBox, value)
	{
		if(thisBox.value == (""))
	    {
            thisBox.value = value;
	    }
	}
