
RadAjaxManager = function(objectData)
{
//	var oldInstance = window[objectData.ClientID];
//	if (oldInstance != null && typeof(oldInstance.Dispose) == "function")
//	{
//	    window.setTimeout(function()
//	    {
//		    oldInstance.Dispose();		    
//	    }, 100);
//	}
//	
	for (var member in objectData)
	{
		if(member == "ClientEvents")
		{
			var clientEvents = objectData[member]
			for (var clientEvent in clientEvents)
			{
				if (typeof(clientEvents[clientEvent]) != "string")
					continue;
				if (clientEvents[clientEvent] != "")
				{
					var handlerString = clientEvents[clientEvent];

					if (handlerString.indexOf("(") != -1)
					{
						// function call
						this[clientEvent] = handlerString;
					}
					else
					{
						// function reference
						this[clientEvent] = eval(handlerString);
					}
				}
				else
				{
					this[clientEvent] = null;
				}
			}
			continue;
		}

		this[member] = objectData[member];
	}
	
	this.Form = document.getElementById(this.FormID);		
}

RadAjaxManager.prototype = new RadAjaxNamespace.RadAjaxControl();

RadAjaxManager.prototype.Dispose = function()
{
	if (this.disposed == true)
		return;
	this.disposed = true;
	
	try
	{
		for (var member in this)
		{
			this[member] = null;
			delete this[member];
		}
	}
	catch(e)
	{
		//
	}
};

RadAjaxManager.prototype.AjaxRequest = function(args)
{
	RadAjaxNamespace.AsyncRequest(this.UniqueID, args, this.ClientID);
};

RadAjaxManager.prototype.AsyncRequest = function(eventTarget, eventArgument, e)
{	
	RadAjaxNamespace.AsyncRequest(eventTarget, eventArgument, this.ClientID, e);
};

RadAjaxManager.prototype.AjaxRequestWithTarget = function(eventTarget, eventArgument)
{	
	RadAjaxNamespace.AsyncRequest(eventTarget, eventArgument, this.ClientID);
};

RadAjaxManager.prototype.AsyncRequestWithOptions = function(options, e)
{
	RadAjaxNamespace.AsyncRequestWithOptions(options, this.ClientID, e);
}

if(!window.RadAjaxManagerNamespace)
{
	window.RadAjaxManagerNamespace = {};
};

RadAjaxManagerNamespace.AsyncRequest = function(eventTarget, eventArgument, clientID, e)
{
	var instance = window[clientID];
	if(instance != null && typeof(instance.AsyncRequest) == "function")
	{
	    instance.AsyncRequest(eventTarget, eventArgument, e);
	}
};

RadAjaxManagerNamespace.AsyncRequestWithOptions = function(options, clientID, e)
{
	var instance = window[clientID];
	if(instance != null && typeof(instance.AsyncRequestWithOptions) == "function")
	{
	    instance.AsyncRequestWithOptions(options, e);
	}
};

//BEGIN_ATLAS_NOTIFY
if (typeof(Sys) != "undefined")
{
    if (Sys.Application != null && Sys.Application.notifyScriptLoaded != null)
    {
        Sys.Application.notifyScriptLoaded();
    }
}
//END_ATLAS_NOTIFY

