var myrules = {
	
	'.demo_mysql' : function(demoM) {
		if($('recap_stat'))
		{
			sorttable.makeSortable($('recap_stat'));
		}
	},
	
	'.tab' : function(tab) {
 		var contentId = window.location.hash || "#First";
		contentId = contentId.substring(1);
		
		var lst = $$(".tab_content");
		for(var i = 0; i < lst.length; i++)
		{
			if(lst[i].id != contentId)
			{
				lst[i].style.display = "none";
			}
		}
		// Hook up the OnLoad event to the tab initialization function.
		Tabs.Init(contentId);
 	},
 	
 	'.tab_link' : function(link) {
 		link.onclick = function() {
 			Tabs.GoTo(link.id.replace("GO_", ""));
 		}
 	},
 	
 	'#valider_stat':function(stat) {
 		stat.onclick = function() {
 			var msgAttente = 'wait_mysql';
 			new Effect.Appear(msgAttente, {duration:0.2});
 			chPOST = FORM_buildpoststring("formstat","record","",1);
 			new Ajax.Request(urlaff, {
				asynchronous: 'true',
				postBody: 'tpl=demos/mysql/visu_stat&datedebut='+$('datedebut').value+'&datefin='+$('datefin').value,
				onSuccess: function (ahr)
				{
					$('conteneur_stat').update(ahr.responseText);
					new Effect.Fade(msgAttente, {duration:0.5});
					Behaviour.apply(); 
			}
			});
 		}
 	}
};

// Enregistrement des regles definies ci dessus dans Behaviour
Behaviour.register(myrules);