/**
 * Creates a Dashboard display.  Grabs the track and adds the line to it via MapController
 */
var DashboardMap = Class.create();
DashboardMap.prototype = {
    /**
     * @param mapId is the id of the map that the map should fit itself into
     * @param activityId is the activityId of the track we want to draw
     * @param showControls determines if we should draw the controls on the map.
     */
    initialize: function(mapId, activityId, showControls) {
        this.mc = new MapController(mapId);
        this.mc.usePositionMarker = false;
        
        var url = "/trail/export/gps/track/js.mb?episodePkValues=" + activityId;
        var myAjax = new Ajax.Request(
    	    url, {
        		onComplete: function(el) {
        		    eval(el.responseText);
                    var track = new Track(trackJSON);
                    this.mc.centerAndScale(track.getStart().getLat(), track.getStart().getLon());
                    this.mc.addTrack(track);
                    this.mc.addStartFinishMarkers(track);
                    this.mc.map.enableDoubleClickZoom();
        		}.bind(this)
        	});
    
        if(showControls) {
            this.mc.map.addControl(new GSmallMapControl());
            this.mc.map.addControl(new GMapTypeControl());
        }
    }
};
