function BoiteDeDialogue()
{
	// Public
	this.id_element				= "";
	this.width 					= 400;
	this.height 				= 200;
	this.minHeight 				= 200;
	this.zIndex	 				= 99;
	this.padding 				= 10;
	this.duree	 				= 7000;
	
	this.borderColor 			= "#FFFFFF";
	this.borderStyle			= "none";
	this.borderWidth			= 1;
	this.backgroundColor		= "#FFFFFF";
	
	this.titre					= "votre titre";
	this.titreColor				= "#000000";
	this.titreSize				= "14px";
	this.titreWeight			= "bold";
	this.titreTextAlign			= "left";
	
	this.sousTitre				= "votre soustitre";
	this.sousTitreColor			= "#000000";
	this.sousTitreSize			= "12px";
	this.sousTitreWeight		= "normal";
	this.sousTitreTextAlign		= "left";
	
	this.texte					= "votre texte";
	this.messages				= "";
	this.texteColor				= "#000000";
	this.texteSize				= "10px";
	this.texteWeight			= "normal";
	this.texteTextAlign			= "left";
	
	this.close					= "[X]";
	this.closeColor				= "#000000";
	this.closeSize				= "11px";
	this.closeWeight			= "bold";
	this.closeTextAlign			= "left";
	
	this.afficherFondSemiTransparent	= true;
	this.couleurFondSemiTransparent		= "#ffa02a";
	this.srcIframeFondSemiTransparent	= "/page-grise.htm";
	this.utiliserEffetdAffichage		= true;
	
	// Privees
	this.divElement 			= null;
	this.titreElement 			= null;
	this.closeElement 			= null;
	this.sousTitreElement 		= null;
	this.texteElement 			= null;
	this.fondTransparent		= null;
	this.onCloseListener 		= Array();
	this.IDTimeout				= null;
	
	// Public
	this.afficher = function ()
	{
		this.trace("afficher()");
		
		if( this.duree != null && this.duree != "" )
		{
			var t = "test"+Math.random();
			window.t = this;
			this.IDTimeout = window.setTimeout("window.t.masquer();", this.duree);
			this.trace("this.IDTimeout = window.setTimeout('window.t.masquer();', this.duree)");
		}
		
		if( this.utiliserEffetdAffichage )
			this.afficherAvecEffet();
		else
			this.afficherSansEffet();
	}
	
	this.masquer = function ()
	{
		this.trace("masquer()");
		
		this.divElement.style.display = 'none';
		for( var i=0; i < this.onCloseListener.length; i++ )
		{
			var t = this.onCloseListener[i];
			this.trace(t+"()");
			t();
		}
		this.fondTransparent.masquer();
		
		if( this.IDTimeout != null )
		{
			this.trace("clearTimeout(this.IDTimeout)");
			clearTimeout(this.IDTimeout);
		}
	}
	
	this.ajouterTexte = function ( HTMLmsg )
	{
		this.trace("ajouterTexte()");
		
		this.messages += HTMLmsg;
	}
	
	this.ajouterNode = function ( HTMLnode )
	{
		this.trace("ajouterTexte()");
		this.initialiserElements();
		
		this.texteElement.appendChild(HTMLnode);
	}
	
	this.viderTexte = function ( )
	{
		this.trace("viderTexte()");
		
		this.messages = "";
	}
	
	this.setTitre = function ( titre )
	{
		this.trace("setTexte()");
		
		this.titre = titre;
		this.titreElement.innerHTML = titre;
	}
	
	this.addOnCloseListener = function ( listener )
	{
		this.trace("addOnCloseListener()");
		
		this.onCloseListener.push(listener);
	}
	
	this.estAfficher = function ()
	{
		this.trace("estAfficher()");
		
		return this.divElement.style.display == 'block'?true:false;
	}
	
	// Privees
	this.afficherSansEffet = function ()
	{
		this.trace("afficherSansEffet()");
		
		this.dessiner();
		this.fondTransparent.afficher();
		this.centerDansLaPage();
		this.divElement.style.display = 'block';
	}
	
	this.afficherAvecEffet = function ()
	{
		this.trace("afficherAvecEffet()");
		
		this.dessiner();
		this.fondTransparent.afficher();
		
		this.divElement.style.width 	= 0;
		this.divElement.style.height 	= 0;
		
		this.titreElement.style.display 	= "none";
		this.closeElement.style.display 	= "none";
		this.sousTitreElement.style.display = "none";
		this.texteElement.style.display 	= "none";
		
		this.centerDansLaPage();
		
		
		new Effect.Scale(this.divElement, 100,{ scaleContent: false,
												scaleY: true,
												scaleX: true,
												scaleFromCenter: true,
											//	scaleMode : "box",
											//	scaleMode : "contents",
												scaleMode : { originalHeight: this.height, originalWidth: this.width },
												scaleFrom : 0.0, 
												beforeStart: function()
												{
													this.divElement.style.display = 'block';
												}.bind(this), 
												afterFinish: function()
												{				
													this.titreElement.style.display 		= "block";
													this.closeElement.style.display 		= "block";
													if( this.sousTitre != "" )	this.sousTitreElement.style.display 	= "block";
													this.texteElement.style.display 		= "block";
												}.bind(this)
												}
												
												);
		
	}
	
	this.dessiner = function ()
	{
		this.trace("dessiner()");
		
		this.initialiserFondTransparent();
		this.initialiserElements();
		this.placerElements();
		this.appliquerPersonnalisation();
		
		document.body.appendChild(this.divElement);
	}
	
	this.initialiserElements = function ()
	{
		this.trace("initialiserElements()");
		
		if( this.divElement == null )
		{
			this.divElement 		= document.createElement("div");
		}
		
		if( this.titreElement == null )
		{
			this.titreElement 		= document.createElement("div");
			this.divElement.appendChild(this.titreElement);
		}
		
		if( this.closeElement == null )
		{
			this.closeElement 		= document.createElement("div");
			this.divElement.appendChild(this.closeElement);
		}
		
		if( this.sousTitreElement == null )
		{
			this.sousTitreElement 		= document.createElement("div");
			this.divElement.appendChild(this.sousTitreElement);
		}
		
		if( this.texteElement == null )
		{
			this.texteElement 		= document.createElement("div");
			this.divElement.appendChild(this.texteElement);
		}
	}
	
	this.initialiserFondTransparent = function()
	{
		this.trace("initialiserFondTransparent()");
		
		if( this.fondTransparent != null )
			return this.fondTransparent;
		
		this.fondTransparent = new fond_transparent();
		
		this.fondTransparent.opacite 			= 0.9;								// de 0 a 1
		this.fondTransparent.backgroundColor 	= this.couleurFondSemiTransparent;	// Couleur de fond
		this.fondTransparent.top			 	= "0px";							// Position TOP du fond
		this.fondTransparent.left			 	= "0px";							// Position LEFT du fond
		
		if( navigateur.estIE && navigateur.version < 7 )
		{
			this.fondTransparent.creerIframe	= true;								// Indique si on créé une iframe, utile pour IE6 < 
			this.fondTransparent.srcIframe	 	= this.srcIframeFondSemiTransparent;// La source de l'iframe 
		}
		
		this.fondTransparent.dessiner();
		
		return this.fondTransparent;
	}
	
	this.placerElements = function ()
	{
		this.trace("placerElements()");
		
		this.divElement.style.display			= "none";
		this.divElement.style.position 			= "absolute";
		this.divElement.style.top	 			= "0";
		this.divElement.style.left	 			= "0";
		this.divElement.style.zIndex 			= parseInt(this.zIndex);
		
		this.titreElement.style.display			= "block";
		this.titreElement.style.position 		= "relative";
		this.titreElement.style.styleFloat 		= "none";
		this.titreElement.style.width 			= (this.width-this.padding*2)+"px";
		
		this.sousTitreElement.style.display		= "block";
		this.sousTitreElement.style.position 	= "relative";
		this.sousTitreElement.style.styleFloat 	= "none";
	//	this.sousTitreElement.style.marginTop 	= "10px";
		this.sousTitreElement.style.width 		= (this.width-this.padding*2)+"px";
		
		if( this.sousTitre == "" )
			this.sousTitreElement.style.display		= "none";
		
		this.texteElement.style.display			= "block";
		this.texteElement.style.position 		= "relative";
		this.texteElement.style.styleFloat 		= "none";
		this.texteElement.style.marginTop 		= "5px";
		this.texteElement.style.width 			= (this.width-this.padding*2)+"px";
		
		this.closeElement.style.display			= "block";
		this.closeElement.style.position 		= "absolute";
		this.closeElement.style.top 			= "5px";
		this.closeElement.style.right 			= "5px";
		this.closeElement.style.width 			= "15px";
		this.closeElement.style.cursor 			= "pointer";
		this.closeElement.controleur			= this;
		this.closeElement.onclick 				= function(){ this.controleur.masquer(); 
		};
	}
	
	this.centerDansLaPage = function ()
	{
		this.trace("centerDansLaPage()");
		
		this.divElement.style.top 	= parseInt( (parseInt(document.body.clientHeight)/2)-this.height/2 )+"px";
		this.divElement.style.left 	= parseInt( (parseInt(document.body.clientWidth)/2)-this.width/2 )+"px";
	}
	
	this.appliquerPersonnalisation = function ()
	{
		this.trace("appliquerPersonnalisation()");
		
		
		this.divElement.id			 					= this.id_element;
		this.divElement.style.width 					= (parseInt(this.width))+"px";
		this.divElement.style.height 					= (parseInt(this.height))+"px";
		//this.divElement.style.minHeight 				= (parseInt(this.minHeight))+"px";
		this.divElement.style.borderColor 				= this.borderColor;
		this.divElement.style.borderWidth 				= (parseInt(this.borderWidth))+"px";
		this.divElement.style.borderStyle 				= this.borderStyle;
		this.divElement.style.backgroundColor 			= this.backgroundColor;
		this.divElement.style.paddingTop 				= this.padding+"px";
		
		this.titreElement.className						= "popin_titre";
		this.titreElement.innerHTML						= this.titre;
		this.titreElement.style.color 					= this.titreColor;
		this.titreElement.style.fontSize 				= this.titreSize+"px";
		this.titreElement.style.textAlign 				= this.titreTextAlign;
		this.titreElement.style.fontWeight 				= this.titreWeight;
		this.titreElement.style.paddingLeft 			= this.padding+"px";
		this.titreElement.style.paddingRight 			= this.padding+"px";
	//	this.titreElement.style.zIndex 					= 1;
	//	this.titreElement.style.backgroundColor 		= "transparent";
		
		this.sousTitreElement.className					= "popin_soustitre";
		this.sousTitreElement.innerHTML					= this.sousTitre;
		this.sousTitreElement.style.color 				= this.sousTitreColor;
		this.sousTitreElement.style.fontSize 			= this.sousTitreSize+"px";
		this.sousTitreElement.style.textAlign 			= this.sousTitreTextAlign;
		this.sousTitreElement.style.fontWeight 			= this.sousTitreWeight;
		this.sousTitreElement.style.paddingLeft 		= this.padding+"px";
		this.sousTitreElement.style.paddingRight 		= this.padding+"px";
	//	this.sousTitreElement.style.zIndex 				= 2;
	//	this.sousTitreElement.style.backgroundColor 		= "transparent";
		
		if( this.sousTitre == "" )
		{
			this.sousTitreElement.style.display		= "none";
		}
		
		this.texteElement.className						= "popin_texte";
		this.texteElement.innerHTML						= "";
		this.texteElement.innerHTML						+= this.texte;
		this.texteElement.innerHTML						+= this.messages;
		this.texteElement.style.color 					= this.texteColor;
		this.texteElement.style.fontSize 				= this.texteSize+"px";
		this.texteElement.style.textAlign 				= this.texteTextAlign;
		this.texteElement.style.fontWeight 				= this.texteWeight;
		this.texteElement.style.paddingLeft 			= this.padding+"px";
		this.texteElement.style.paddingRight 			= this.padding+"px";
	//	this.texteElement.style.zIndex 					= 3;
	//	this.texteElement.style.backgroundColor 		= "transparent";
		
		this.closeElement.className						= "popin_close";
		this.closeElement.innerHTML						= this.close;
		this.closeElement.style.color 					= this.closeColor;
		this.closeElement.style.fontSize 				= this.closeSize+"px";
		this.closeElement.style.textAlign 				= this.closeTextAlign;
		this.closeElement.style.fontWeight 				= this.closeWeight;
		this.closeElement.style.paddingLeft 			= this.padding+"px";
		this.closeElement.style.paddingRight 			= this.padding+"px";
		this.closeElement.style.zIndex 					= 900;
		/*
		this.titreElement.style.backgroundColor 		= "#E5E8E8";
		this.sousTitreElement.style.backgroundColor 		= "#C7C8C8";
		this.texteElement.style.backgroundColor 		= "#A3A3A3";
		*/
	}
	
	this.trace = function ( m )
	{
		traceur.inst().trace(m+"<br />");
	}
	
	this.trace("</hr>BoiteDeDialogue()");
	
}
