if (typeof(ComfyTel) === 'undefined') Type.registerNamespace("ComfyTel");

ComfyTel.AjaxRequestIconManager = function(containerID) {
    this.containerID = containerID;
}

ComfyTel.AjaxRequestIconManager.prototype = {

    _showIcon : function(show) {

        var container = $(document.getElementById(this.containerID));
        
        if (show) {

            var imgWidth = 100;
            
            var x = document.body.offsetWidth / 2 - imgWidth / 2 + 'px';

            var cssPosition = 'fixed';
            var version = $.browser.version.charAt(0);
            if (($.browser.msie == true) // is ie
                && ((version == '6') || (version == '7'))) {
                
                // ie 6 and some of 7 does not support 'fixed'
                cssPosition = 'absolute'; 
            }

            container.css({ display : 'block', position : cssPosition, top : '175px', left : x });

        } else {
        
            container.css({ display : 'none' });
        }
    },
    
    beginRequest : function(form, request) {
        var iconElement = ajaxRequestIconManager._showIcon(true);
    },
    
    endRequest : function(form, errorHandler) {
        var iconElement = ajaxRequestIconManager._showIcon(false);
    }
};

ComfyTel.AjaxRequestIconManager.registerClass('ComfyTel.AjaxRequestIconManager', Sys.UI.Control);
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
