var Attente = Class.create({
	
	initialize: function(){
	    $$$A = this;
	},
	
	show: function(){
	    
	    //Création du calque opacifiant
	    $$('body')[0].insert('<div id="A_background" class="off"></div>','bottom');
	    $('A_background').setStyle({display: 'block',visibility: 'hidden'});        
	    $('A_background').setStyle({height: this.getWinHeight() + "px"});
	    $('A_background').morph('on', { duration: 0.2});
	    var contenu = "<div id='A_container'><div id='A_loader'></div></div>";
	    //<div id='A_loader'><img src='module/Attente/ajaxloader.gif' width='100' height='100'></div></div>";
	    $('A_background').insert({after: contenu});
	    $('A_container').setStyle({top: parseInt(this.getScrollPosition()) + 'px'});
	    
	    $('A_background').setStyle({visibility: 'visible'});
	
	},
	
	hide: function(){
		if($('A_loader')) $('A_loader').remove();
		if($('A_container')){
			$('A_container').remove();
		}
		if($('A_container')){
			$('A_container').remove();
		}
	    if($('A_background')) $('A_background').remove();
	},
	
	getScrollPosition: function()
    {
        return ((document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
    },
	
	getWinHeight: function() {
		  var height = document.documentElement.scrollHeight;
		  if(document.documentElement.clientHeight > height ) {
			  height  = document.documentElement.clientHeight;
		  }
		  if(document.body.scrollHeight > height) {
			  height = document.body.scrollHeight;
		  }
		  return height;
	},
	
	getRealWinHeight: function(){
		if (document.body){
			return(document.body.clientHeight);
		} else {
			return(window.innerHeight);
		}
	}
});
