﻿// JScript File
Type.registerNamespace('TrackMe.Api');

TrackMe.Api.Request = function(id, method, args) 
{
    var url = TrackMe.apiUrl(method);
    var sep = "?";
    if (args != null) 
    {
        for(var name in args)
        {
            url += sep + name + "=" + escape(args[name]);
            sep = "&";
        }
    }
    this.jsonRequest = new JsonRequest(id, url);
}
    
TrackMe.Api.Request.prototype = 
{
    doRequest: function(callback)	
    {
        this.jsonRequest.doRequest(callback);
    }
}

TrackMe.Api.GetSession = function(sessionId, callback)
{
    if (typeof(__sessionId) !== "undefined") 
    {
      var args = { sid : __sessionId, type: "json", dlaps: false };
      var request = new TrackMe.Api.Request("getsession", "ActivityData", args)
      api.doRequest(callback);
    }
}

// Notify ScriptManager that this is the end of the script.
if (typeof(Sys) !== 'undefined') {
  Sys.Application.notifyScriptLoaded();
}
