﻿Type.registerNamespace("Univ.WebControls");

Univ.WebControls.ModalUpdateProgress = function(element)
{
	Univ.WebControls.ModalUpdateProgress.initializeBase(this, [element]);
	
	var fakeElement = document.createElement("div");
	this._modalPopupBehavior = new Univ.WebControls.ModalPopupBehavior(fakeElement);
	this._modalPopupBehavior.set_PopupControlID(this.get_element().id);
}
Univ.WebControls.ModalUpdateProgress.prototype = 
{
	initialize : function()
	{
		Univ.WebControls.ModalUpdateProgress.callBaseMethod(this, 'initialize');
		
		this._modalPopupBehavior.initialize();
	},
	
	get_backgroundCssClass : function()
	{
		return this._modalPopupBehavior.get_BackgroundCssClass();
	},
	set_backgroundCssClass : function(value)
	{
		this._modalPopupBehavior.set_BackgroundCssClass(value);
	},
	
	get_dropShadow : function()
	{
		return this._modalPopupBehavior.get_DropShadow();
	},
	set_dropShadow : function(value)
	{
		return this._modalPopupBehavior.set_DropShadow(value);
	},
	
	get_drag : function()
	{
		return this._modalPopupBehavior.get_Drag();
	},
	set_drag : function(value)
	{
		return this._modalPopupBehavior.set_Drag(value);
	},
	
	get_x : function()
	{
		return this._modalPopupBehavior.get_X();
	},
	set_x : function(value)
	{
		return this._modalPopupBehavior.set_X(value);
	},
	
	get_y : function()
	{
		return this._modalPopupBehavior.get_Y();
	},
	set_y : function(value)
	{
		return this._modalPopupBehavior.set_Y(value);
	},
	
	get_popupDragHandleControlID : function()
	{
		return this._modalPopupBehavior.get_PopupDragHandleControlID();
	},
	set_popupDragHandleControlID : function(value)
	{
		return this._modalPopupBehavior.set_PopupDragHandleControlID(value);
	},

	_startRequest : function()
	{
		if (this._pageRequestManager.get_isInAsyncPostBack())
		{
            this._modalPopupBehavior.show();
        }
        
        this._timerCookie = null;
	},
	
	_handleEndRequest : function(sender, arg)
	{
		this._modalPopupBehavior.hide();
		
        if (this._timerCookie)
        {
            window.clearTimeout(this._timerCookie);
            this._timerCookie = null;
        }		
	}
}
Univ.WebControls.ModalUpdateProgress.registerClass("Univ.WebControls.ModalUpdateProgress", Sys.UI._UpdateProgress);

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();