// Copyright (c) 2008, HeroCoder.com
// All rights reserved.

/// <reference name="MicrosoftAjax.js"/>
Type.registerNamespace('Hero.Common.Controls');

///////////////////////////////////////////////////////////////////////////////
// ModalPopupBehavior
///////////////////////////////////////////////////////////////////////////////
Hero.Common.Controls.ModalPopupBehavior = function(element) 
{
    Hero.Common.Controls.ModalPopupBehavior.initializeBase(this, [element]);
    this._FocusControlID = null;
}

Hero.Common.Controls.ModalPopupBehavior.prototype = 
{
    initialize : function() 
    {
        Hero.Common.Controls.ModalPopupBehavior.callBaseMethod(this, 'initialize');
    },

    dispose : function() 
    {
        Hero.Common.Controls.ModalPopupBehavior.callBaseMethod(this, 'dispose');
    },

    get_FocusControlID : function() 
    {
        return this._FocusControlID;
    },

    set_FocusControlID: function(value) 
    {
        this._FocusControlID = value;
    },
    
    _onShow:function(e) 
    {
        Hero.Common.Controls.ModalPopupBehavior.callBaseMethod(this, '_onShow',[e]);
        if (this._FocusControlID)
        {
            var focusElement = $get(this._FocusControlID);
            if(focusElement)
                focusElement.focus();
        }
    }
}

Hero.Common.Controls.ModalPopupBehavior.registerClass('Hero.Common.Controls.ModalPopupBehavior', AjaxControlToolkit.ModalPopupBehavior);