﻿
/* ASP.NET AJAX - event help class 
 * Dependencies: ASP.NET AJAX
 * @author : Isotop AB
 */ 
 
function AjaxEvents()
{
	this.currentCallBack = null;
	this.currentCallInit = null;  
	this.onCallBack = function(f)
	{
		this.currentCallBack = f;
		try {Sys.WebForms.PageRequestManager.getInstance().add_endRequest(f);}
		catch(e) {} 
	}
	
	this.disposeOnCallBack = function(f)
	{
		try {Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(f);}
		catch(e) {} 
	}
	
	this.onCallInit = function(f)
	{
		this.currentCallInit = f;
		try {Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(f);}
		catch(e) {} 
	}	
	
	this.disposeOnCallInit = function(f)
	{
		try {Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(f);}
		catch(e) {} 
	}	
	
	this.disposeAll = function()
	{
		this.disposeOnCallBack(this.currentCallBack);
		this.disposeOnCallInit(this.currentCallInit);
	}
}

var ajaxEvent = new AjaxEvents();

