function fond_transparent()
{
	// public
	this.zIndex 			= "99";			// de 0 a 1
	this.opacite 			= 0.5;			// de 0 a 1
	this.width			 	= "990px";		// Largeur du fond
	this.backgroundColor 	= "#FFFFFF";	// Couleur de fond
	this.top			 	= "0px";		// Position TOP du fond
	this.left			 	= "0px";		// Position LEFT du fond
	this.creerIframe	 	= false;		// Indique si on créé une iframe, utile pour IE6 < 
	this.srcIframe	 		= "";			// La source de l'iframe 
	this.utiliserEffet 		= true;			// Indique si on utilise un effet pour l'affichage
	
	// privées
	this.divElement 		= null;			// Un élément HTML
	this.iframeElement 		= null;			// L'élément HTML de l'iframe
	
	// public
	this.obtenirElement = function ()
	{
		if( this.divElement == null )
			this.creerFond();
		return this.divElement;
	}
	
	this.dessiner = function ()
	{
		this.creerFond();
		return this.divElement;
	}
	
	this.afficher = function ()
	{
		if( this.utiliserEffet )
			this.afficherAvecEffet();
		else
			this.afficherSansEffet();
	}
	
	this.afficherAvecEffet = function ()
	{
		var el = this.obtenirElement();
		
		if( el != null )
			$(el.id).appear({ duration: 0.2, from:0, to:0.5 });
	}
	
	this.afficherSansEffet = function ()
	{
		var el = this.obtenirElement();
		if( el != null )
			el.style.display = 'block';
	}
	
	this.masquer = function()
	{
		if( this.utiliserEffet )
			this.masquerAvecEffet();
		else
			this.masquerSansEffet();
	}
	
	this.masquerAvecEffet = function()
	{
		var el = this.obtenirElement();
		if( el != null )
			$(el.id).fade({ duration: 0.2 });
	}
	
	this.masquerSansEffet = function()
	{
		var el = this.obtenirElement();
		if( el != null )
			el.style.display = 'none';
	}
	
	// privée
	this.creerFond = function ()
	{
		var docHeight 	= YAHOO.util.Dom.getViewportHeight();
		var docWidth 	= YAHOO.util.Dom.getViewportWidth();
		var docHeight 	= document.body.clientHeight;
		var docWidth 	= document.body.clientWidth;
		
		var div 					= document.createElement("div");
		div.style.position 			= "absolute";
		div.style.backgroundColor 	= this.backgroundColor;
		div.style.width 			= (parseInt(docWidth))+"px";
		div.style.height 			= (parseInt(docHeight))+"px";
		div.style.top 				= this.top;
		div.style.left 				= this.left;
		div.style.zIndex			= this.zIndex;
		div.style.display			= "none";
		
		div.style.opacity 			= this.opacite; 									//navigateurs récents (firefox, opera, Safari>1,2...) css3
		div.style.MozOpacity 		= this.opacite; 									//anciennes versions firefox
		div.style.KhtmlOpacity 		= this.opacite5; 									//Konqueror, Safari<1,2
		div.style.filter 			= "alpha(opacity=" + this.opacite * 100 + ")"; 		//Internet Explorer
		
		if( this.creerIframe )
		{
			this.creerFondIframe( div );
		}
		
		var id = Math.random();
		while( document.getElementById("my"+id) != null )
			id = Math.random();
		div.id = "my"+id;
		
		var b = document.getElementsByTagName("body");
		b = b[0];
		b.appendChild(div);
		
		this.divElement = div;
	}
	
	this.creerFondIframe = function ( divElement )
	{
		var iframe 						= document.createElement("iframe");
		
		divElement.appendChild(iframe);
		
		iframe.style.borderStyle 		= 'none';
		
		iframe.style.position 			= "absolute";
		iframe.style.backgroundColor 	= this.backgroundColor;
		iframe.style.width 				= "100%";
		iframe.style.height 			= "100%";
		iframe.style.top 				= "0px";
		iframe.style.left 				= "0px";
		iframe.style.display			= "block";
		
		iframe.style.opacity 			= this.opacite; 									//navigateurs récents (firefox, opera, Safari>1,2...) css3
		iframe.style.MozOpacity 		= this.opacite; 									//anciennes versions firefox
		iframe.style.KhtmlOpacity 		= this.opacite5; 									//Konqueror, Safari<1,2
		iframe.style.filter 			= "alpha(opacity=" + this.opacite * 100 + ")"; 		//Internet Explorer
		
		iframe.src						= this.srcIframe;
		
		this.iframeElement = iframe;
	}
}

fond_transparent.instance = null;
fond_transparent.getInstance = function()
{

	if( fond_transparent.instance == null )
		fond_transparent.instance = new fond_transparent();
	return fond_transparent.instance;
}
