	var bref_id_visible = '';
	var protection = false;
	
	function oldchapitreDisplay(id,display)
	{
		// on cherche les childs titre et html
		childs = $(id).childElements();
		for (i = 0 ; i < childs.length ; i++)
		{
			if (childs[i].hasClassName("html")) { child_html = childs[i]; }
		}
		if (display == "show")
		{
			child_html.removeClassName("hide");
			child_html.addClassName("show");
			$(id).addClassName("selected");
		}
		else
		{
			child_html.removeClassName("show");
			child_html.addClassName("hide");
			$(id).removeClassName("selected");
		}
	}
	
	
	
	function oldchapitreClic(id)
	{

		// si le chapitre est selectionne, on masque le html et on deselectionne le chapitre
		if ($(id).hasClassName("selected")) 
		{ 
			oldchapitreDisplay(id,"hide"); 
			bref_id_visible = '';
			return;
		}
		

		// si on a un chapitre deja visible, on le cache
		if (bref_id_visible != '')
		{
			oldchapitreDisplay(bref_id_visible,"hide"); 
			bref_id_visible = '';
		}
		
		// on affiche le chapitre cliqué
		oldchapitreDisplay(id,"show"); 
		bref_id_visible = id;
		
	}
	
	function newchapitreDisplay(show,hide)
	{
		
		var s1 = null;
		var s2 = null;
		var my_seq = new Parallel();
		if (show != null)
		{
			
			// on cherche les childs titre et html
			childs = $(show).childElements();
			
			for (i = 0 ; i < childs.length ; i++)
			{
				if (childs[i].hasClassName("html")) { child_html = childs[i]; }
			}
			
			var s1_height = child_html.getHeight();
			child_html.makeClipping().setStyle({height : '0px', display: 'block'});
			
			s1 = new Tween(child_html.style,'height',Tween.regularEaseIn,0,s1_height,1,'px');
		
			$(show).addClassName("selected");
			my_seq.addChild(s1);
		}
		if (hide != null)
		{
			// on cherche les childs titre et html
			childs = $(hide).childElements();
			for (i = 0 ; i < childs.length ; i++)
			{
				if (childs[i].hasClassName("html")) { child_html = childs[i]; }
			}
			
			var s2_height = child_html.getHeight();

			child_html.makeClipping().setStyle({height: '0px', display: 'block'});
		
			s2 = new Tween(child_html.style,'height',Tween.regularEaseIn,s2_height,0,1,'px');
			
			s2.onMotionFinished = function()
			{
				child_html.makeClipping().setStyle({height: s2_height+ 'px', display: 'none'});
			}
			
			my_seq.addChild(s2)
			$(hide).removeClassName("selected");
		}
		
		my_seq.onMotionFinished = function()
		{
			protection = false;
		}
		my_seq.start();
	}

	function newchapitreClic(id)
	{
		var hide = null;
		var show = null;
		// si le chapitre est selectionne, on masque le html et on deselectionne le chapitre
		if ($(id).hasClassName("selected")) 
		{ 
			hide = id;
			//chapitreDisplay(id,"hide"); 
			bref_id_visible = '';
			newchapitreDisplay(show,hide);
			return;
		}
		

		// si on a un chapitre deja visible, on le cache
		if (bref_id_visible != '')
		{
			hide = bref_id_visible;
			//chapitreDisplay(bref_id_visible,"hide"); 
			bref_id_visible = '';
		}
		
		show = id;
		// on affiche le chapitre cliqué
		newchapitreDisplay(show,hide); 
		bref_id_visible = id;
	}
		
	
	

	function chapitreClic(p1)
	{
		if(Prototype.Browser.Gecko || Prototype.Browser.Opera || Prototype.Browser.IE)
		{
			// si il y a une anime en cours on interdit le clic
			if (protection == true) return;
			protection = true;
			newchapitreClic(p1);
		}
		else
		{
			oldchapitreClic(p1);
		}
		
	}
	

	
