Overlay = {
init: function(){
		this.start();
	},

start: function(){
		//SI DIVS EXISTENT PAS ON LES CRÉE//	
		$('<div id="HoverNav" style="display:none;"></div>').prependTo('body');  
		$('<div id="Overlay" style="display:none;"></div>').prependTo('body');  	

		$('#Overlay').css({'opacity':'0.8', 'z-index':'20', 'background-color':'#FFFFFF', 'position':'absolute','top':'0px','left':'0px'});
		$('#HoverNav').css({'z-index':'21', 'background-color':'#FFFFFF', 'position':'absolute','top':'0px','left':'0px'});
		
		$('#Overlay').click(function(){
			Overlay.hide();
			return false;
		});
	},

display: function(_content,_width){
		// annuler suivi lien sur IE6 => fonctions.js //
		suppr_event_ie6();

		this.arrayPageSize = getPageSize();
		_content='<div id="popup"><a id="close" style="cursor:pointer;">FERMER</a>'+ _content ;
		_content+='</div>';
		
		//SI DIV PAS ENCORE AFFICHÉ => FADE IN//
		if($('#HoverNav').css('display') == 'none'){
			$('#HoverNav').html('');
			$('#Overlay').width(this.arrayPageSize[0]);
			$('#Overlay').height(this.arrayPageSize[1]);
			$('#HoverNav').css({'width': _width + 'px'});
			$('#Overlay').css('filter', 'alpha(opacity=60)');
			$('#Overlay').fadeIn("fast", function(){
				$('#HoverNav').show();
			});
			
			$('#HoverNav').html(_content);
			
			$('#close').click(function(){
				Overlay.hide();
				return false;
			});			

			if($('#HoverNav').height() > 450){
				$('#HoverNav .content').css('height', '450px');
				$('#HoverNav .content').css('overflow', 'auto');
			}	

			windowCenter("HoverNav");

			if (nav[0]=='IE' && nav[1]==6){
				//$('#page select').hide();
				$('body > *').bgiframe();
			}
		}else{
			//alert('3');
			$('#HoverNav').html(_content);
			$('#close').click(function(){	
				Overlay.hide();
				return false;
			});	
		}
	},

	display_from_url:function(_url,_width, _datas){
		/** !!! join datats (&) !!! **/
	
		if(_width==undefined){
			_width=550;
		}
	
		$.ajax({
type: "GET",
url: _url,
async: false,
data: '',
success: function(msg){
				Overlay.display(msg, _width);
			}
		});
	},

hide:function(){
		$('#HoverNav').fadeOut('fast');
		$('#Overlay').fadeOut('fast');
	}
};

$(function(){
	Overlay.init();
});
