	/*
		Tracker specific functions
	*/
	
	//gets degrees (0-360) and returns a direction in string format
	function getDirectionString(direction) {
		var dirString;
		if ((direction <= 360 && direction >= 330) || (direction <= 30 && direction >= 0)) {
			dirString = "N";
		} else if (direction <= 60 && direction > 30) {
			dirString = "NE";
		} else if (direction <= 120 && direction > 60) {
			dirString = "E";
		} else if (direction <= 150 && direction > 120) {
			dirString = "SE";
		} else if (direction <= 210 && direction > 150) {
			dirString = "S";
		} else if (direction <= 240 && direction > 210) {
			dirString = "SW";
		} else if (direction <= 300 && direction > 240) {
			dirString = "W";
		}  else if (direction <= 330 && direction > 300) {
			dirString = "NW";
		} 				 	 	
		return dirString;
	}
	
	
	function getPath(i) {
	var request=init();
	var points = [];
	var lat;
	var lng;
	
	function init(){
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		} else if (window.ActiveXObject) {			   
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
	}		
		
	var url="XMLpath2.asp" +"?boatID="+carGroupID[i];
	//alert(carGroupID[i]);
	url=url+"&sid="+Math.random();
	request.open("GET", url, true);

	request.onreadystatechange = 
		function() {
				
			if (request.readyState == 4 && request.status == 200) {										
				var xmlDoc = request.responseXML;
				// obtain the array of markers and loop through it
				var path = xmlDoc.documentElement.getElementsByTagName("position");
				var numPos = path.length;						
					
				if (numPos > 0) {																				
					for( var j = 0; j < numPos; j++) {										
						lat=parseFloat(path[j].getAttribute("boatLat"));
						lng=parseFloat(path[j].getAttribute("boatLng"));
						points.push(new GLatLng(lat, lng));
					}//for								
					
					var index = Math.round(Math.random() * 9);
					var ColorValue = "#FFFF00"; // default color - white (index = 0)
												
					if (polyOverlay) {
						map.removeOverlay(polyOverlay);
					}
						polyOverlay = new GPolyline(points, ColorValue, 3);
						map.addOverlay(polyOverlay);
		
						//set zoom to show path and curr position
					
						var gBounds = new GLatLngBounds();																	
											
						for (var j=0; j<points.length;j++ ) {
							gBounds.extend(points[j]);
						}
				
						var zoomLevel = map.getBoundsZoomLevel(gBounds);
						var center = gBounds.getCenter();
						map.setCenter(center, zoomLevel,G_SATELLITE_MAP);  		
						
					} else {
						alert("No path data available!");
					}

				} 
		 }//function

	 	request.send(null);		
	 	
	 	
						
		//map.getInfoWindow().hide();
						
	}



	function removePath() {
		if (polyOverlay) {
			map.removeOverlay(polyOverlay);
		}
	}
