var slides = Array();

window.addEvent('domready', function() {
	$ES('.bulletpoint_contenu').each(function(item) {
		slides[item.id] = new Fx.Slide(item.id, {wait: false, duration: 500});
		slides[item.id].hide();
	});

});


function switchBulletPointContent(id, btn, hash) {
	if($(id)) {
		var titre = $(id);
		var scrollBar;

		// on recupere la hauteur du scroll
		chaine = $ES('.contenu')[0].id;
		tab = chaine.split("_");
		my_height = tab[1];
		if (my_height == 'undefined') my_height = 330;

		$ES('.bulletpoint_contenu').each(function(item) {
			if(item.id != titre.id) {
				slides[item.id].slideOut();
			}
		});

		if(titre.getStyle('margin-top') == '0px') {
			slides[titre.id].slideOut();
			//$("titre_"+id).className = "bulletpoint_titre";
		}//if
		else
		{

			slides[titre.id].slideIn().addEvent('onComplete',
			function(e)
			{

			if(e.getParent().getStyle('height') !=  '0px') {
				btn.setHTML('> Fermer');
				scrollBar = $ES('.contenu')[0].getChildren()[0];
				//Si j'ai une scroll bar déjà
				if(scrollBar.getChildren()[0] && scrollBar.getChildren()[0].className == "botoescrollbar")
				{
					//scrollBar.setStyle('display','block');
				}
				//Si j'ai pas de scroll déjà
				else
				{
					var c = document.getElementById('oetemdoc_scroll');
					botoescroll(c, {height:330, width:0, top:0, thumbHeight:0});
				}
				oe_scroll_goTo(hash);

			} //if margin-top != 0 -> cas d'un slideOut
			else
			{
				if($ES('.contenu')[0].getChildren()[1] && $ES('.contenu')[0].getChildren()[1].scrollHeight <= my_height)
				{
					scrollBar = $ES('.contenu')[0].getChildren()[0];
					scrollBar.setStyle('display','none');
				}
				btn.setHTML('> En savoir +');

			}

			});/*function onComplete*/

		}//else



	}



}