﻿/// <reference name="MicrosoftAjax.js"/>

/***********************************************************************************************
/*********Author:		    horace
/*********Created:		    2010-04-07
/*********Last Modified:	2010-04-08
/***********************************************************************************************/

Type.registerNamespace("LMOpac");

LMOpac.ModalUpdateProgress = function(element) {
    LMOpac.ModalUpdateProgress.initializeBase(this, [element]);

    var fakeElement = document.createElement("div");
    this._modalPopupBehavior = new AjaxControlToolkit.ModalPopupBehavior(fakeElement);
    this._modalPopupBehavior.set_PopupControlID(this.get_element().id);
}
LMOpac.ModalUpdateProgress.prototype =
{
    initialize: function() {
        LMOpac.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;
        }
    }
}
LMOpac.ModalUpdateProgress.registerClass("LMOpac.ModalUpdateProgress", Sys.UI._UpdateProgress);

