var AjaxLoadingEffect = Class.create();

AjaxLoadingEffect.prototype = ({
	
	initialize: function(config)
	{
		this._options = {};
		this.containerId						= config.containerId;
		//this._options['loadingEffectID']	= config.containerId + '_loading';
		this._options['loadingEffectCSS'] 		= 'winLoadingEffect';
		this._options['loadingEffectCSSLoader'] = (config.cssLoadingEffect)?config.cssLoadingEffect:'winLoadingEffectLoader';
		this.LoadingEffect 	= null;
		this.Preloader 		= null;
	},
		
	setLoadingEffect: function()
    {
		var win =$( this.containerId);
        if ( win )
        {
            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']);
                	/**
                	 * document.viewport.getScrollOffsets()[0]
                	 */
	                $(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){        	            
            this.LoadingEffect.remove();
            this.LoadingEffect = null;
        }
        if( this.Preloader ){
        	this.Preloader.remove();
        	this.Preloader = null;
        }
    }
});
