function GPSTracker(ob) {
	this.map = ob;
	this.json = null;
	this.data = null;
	this.nodes = null;
	this.poly = null;
}

GPSTracker.prototype.drawMap = function(element,lat,lng,zoom) {
	var element = document.getElementById(element);
	var origin = new google.maps.LatLng(lat,lng);
	var mapOptions = {
		zoom: zoom,
		center: origin,
		mapTypeControl: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	this.map = new google.maps.Map(element, mapOptions);
}

GPSTracker.prototype.loadDataToMap = function(dataSource,type) {
	if(type=="json") {
		ob = this;
		ajaxOb.sendRequest(dataSource,'',function(){
			ob.data = JSON.parse(ajaxOb.xmlResponseText);
			ob.loadJSONData();
		});


	} else if(type=="xml") {
		
	} else {
		alert("Undefined data format");
		return;
	}
}

GPSTracker.prototype.loadJSONData = function() {	
	var trackerNodes = new Array();
	var locations = this.data;
	
	for(i in locations) {
		trackerNodes.push(new google.maps.LatLng(locations[i].lat,locations[i].lng));
	}
	var trackerPath = new google.maps.Polyline({
		path: trackerNodes,
		strokeColor: "#FF0000",
		strokeOpacity: 1.0,
		strokeWeight: 2
	});
	
	this.nodes = trackerNodes;
	this.poly = trackerPath;
	
	trackerPath.setMap(this.map);
	this.centreMap(locations[0].lat,locations[0].lng);
}

GPSTracker.prototype.centreMap = function(lat,lng,zoom) {
	this.map.panTo(new google.maps.LatLng(lat,lng));
	if(typeof(zoom)=="number")
		this.map.setZoom(zoom);
}
	
	
GPSTracker.prototype.clearMap = function() {
	if(this.nodes) {
	}
	if(this.poly) {
		this.poly.setMap(null);
	}
}