var AjaxLoadingEffect = Class.create();

AjaxLoadingEffect.prototype = ({
	
	initialize: function(config)
	{
		this._options = {};
		this.containerId						= config.containerId;
		this._options['loadingEffectID']		= config.containerId + '_loading';
		if (config.loadingEffect) {
			this._options['loadingEffectCSS'] = config.loadingEffect;
		}
		else {
			this._options['loadingEffectCSS'] = 'winLoadingEffect';
		}				
		if (config.loadingEffectLoader) {
			this._options['loadingEffectCSSLoader'] = config.loadingEffectLoader;
		}
		else {
			this._options['loadingEffectCSSLoader'] = 'winLoadingEffectLoader';
		}
		this.LoadingEffect 						= null;
		this.Preloader 							= null;
	},
		
	setLoadingEffect: function()
    {
		var win = $(this.containerId);
        if ( win )
        {
        	try {
        		IEHTMLSelectElement.fix(document.getElementsByTagName('select'));	
        	} catch (error) {}
            var body = document.getElementsByTagName('body')[0];
            this.LoadingEffect = document.createElement('div');
            this.LoadingEffect.id = this._options['loadingEffectID'];
            
            if ( this.LoadingEffect )
            {
                $(this.LoadingEffect).addClassName(this._options['loadingEffectCSS']);
                $(this.LoadingEffect).setStyle(
                    {
                        'width':win.getWidth()+'px',
                        'height':win.getHeight()+'px',
                        'left':(Utils.getLeftPos(win))+'px',
                        'top':Utils.getTopPos(win)+'px'
                    }
                );
                body.appendChild(this.LoadingEffect);
                
                this.Preloader = document.createElement('div');
                if(this.Preloader)
                {
                	$(this.Preloader).addClassName(this._options['loadingEffectCSSLoader']);
	                $(this.Preloader).setStyle(
	                    {
	                        'width':this.LoadingEffect.getWidth()+'px',
	                        'height':this.LoadingEffect.getHeight()+'px',
	                        'left':(Utils.getLeftPos(this.LoadingEffect))+'px',
	                        'top':Utils.getTopPos(this.LoadingEffect)+'px'
	                    }
	                );
	                body.appendChild(this.Preloader);
                	
                }
                 
                //this.tabAjaxRequestProperties["tabLoadingProgressShown"] = true;
            }
        }
    },
    
    removeLoadingEffect: function()
    {
        if ( this.LoadingEffect){
            Element.remove( this.LoadingEffect );
        }
        if( this.Preloader){
        	Element.remove(this.Preloader);
        }
    }
});