var Modmsg = {
    msg_bloc:"msg_display",
    msg_content:"msg_content",
	msg_btn:"msg_btn",
	msg_header_info:"msg_header_info",
	msg_header_ask:"msg_header_ask",
	msg_duree:2000,
	msg_btn_id:"",
	initialized:true,
    info:function(msg,classname,noduree) {
    	var noduree = noduree || false;
		//Masque les boutons
		$(this.msg_btn).style.display="none";

		//Set la class
		if(classname != "")
			$(this.msg_bloc).className = classname;

		//Affiche la bon header
		$(this.msg_header_info).style.display="";
		$(this.msg_header_ask).style.display="none";

		$(this.msg_content).update(msg);

		if(noduree === false || noduree > 0)
		{
			if(noduree>0)
				var duree = noduree;
			else
				var duree = this.msg_duree;
				
			new Effect.Appear($(this.msg_bloc), {afterFinish: function(){TOOL_tempo(duree,"STD_ClearUsrMsg");}});			
		}else{
			new Effect.Appear($(this.msg_bloc));			
		}
    },
    ask:function(msg,classname,btn_id) { 
		//Affiche les boutons
		$(this.msg_btn).style.display="";

		//Set la class
		if(classname != "")
			$(this.msg_bloc).className = classname;

		//Affiche la bon header
		$(this.msg_header_info).style.display="none";
		$(this.msg_header_ask).style.display="";

		$(this.msg_content).update(msg);

		//Remplace l'id du bouton
		this.msg_btn_id = btn_id.replace("confirm_","");

		new Effect.Appear($(this.msg_bloc));
					
    },
	hide:function() { 
		$(this.msg_bloc).style.display="none";
	} ,
	exec:function(){
		STD_ClearUsrMsg();
		if(this.msg_btn_id!="")
			PHX_executeFct(this.msg_btn_id);
	}
} 

var myrules = {
	//Operations d'administration
	'#msg_btn_valid': function(btn) {
		btn.onclick = function(){
			Modmsg.exec();
		}	
	}
};
// *******************************************
//
// REGLES COMPORTEMENT ENREGISTREMENT
//
// *******************************************
Behaviour.register(myrules);
