﻿/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />
/// <reference path="jquery-1.2.6.pack.js" />

Type.registerNamespace('Custom');

Custom.UpdatePanelAnimationBehavior = function(element) {
	Custom.UpdatePanelAnimationBehavior.initializeBase(this, [element]);
};

Custom.UpdatePanelAnimationBehavior.prototype = {
	initialize: function() {
		Custom.UpdatePanelAnimationBehavior.callBaseMethod(this, 'initialize');
	},

	dispose: function() {
		Custom.UpdatePanelAnimationBehavior.callBaseMethod(this, 'dispose');
	},

	_pageLoaded: function(sender, args) {
		//avoid base call and just cancel animation. this appears to be a design limitation with multiple update panels and multiple instances of update panel animation
		if (this._postBackPending) {
			this._postBackPending = false;
			this._onUpdating.quit();
			this._onUpdated.play();
		}
	}
};

Custom.UpdatePanelAnimationBehavior.registerClass('Custom.UpdatePanelAnimationBehavior', AjaxControlToolkit.Animation.UpdatePanelAnimationBehavior);
Sys.Application.notifyScriptLoaded();

