var DownloadManager = {

    req: null,

    Get: function(tool, url, expire, callback)
    {
        try
        {
            if (this.req == null)
            {
                this.req=new Array();
            }

            var text = tool.GetCachedFileContent(url, expire);
            if (text)
            {
                callback(text);
            }
            else
            {
                var reqId = tool.RequestURLAsync(url);
                this.req[reqId] = {"callback": callback, "url": url};

            }

        }catch(e){alert(e);}
    },

    LoadDone: function(tool, rid, success)
    {
        try
        {
            if (typeof(this.req[rid]) != 'undefined' && typeof(this.req[rid].callback) == 'function')
            {
                var text = tool.GetCachedFileContent(this.req[rid].url, 0);

                if (text && text != "")
                {
	                this.req[rid].callback(text);

	                this.req[rid].callback=null;
	                this.req[rid]=null;

	                return true;
                }
            }

            return false;

        }catch(e){alert(e);}
    }
};

