// Fonctions de mise en page avec lib Mootools


// fonctions a executer a partir du domready

window.addEvent('domready', function() {

	
	if ($('zones_extensibles'))
	{	
			var list = $$('#contenu .zone');
			var headings = $$('#contenu .zone h1');
			var spans = new Array();	
			var collapsibles = new Array();
			var zone = $('zones_extensibles').innerHTML;
			
			headings.each( function(heading, i) {

				//var collapsible = new Fx.Style(list[i], 'height',{duration: 500});
				var collapsible = new Fx.Tween(list[i]);

				collapsibles[i] = collapsible;
				
				heading.onclick = function(){
				
				  //var span = $E('span', heading);
					for(var j = 0; j < collapsibles.length; j++){
						if(j!=i ) { //&& j!=(zone-1)
							collapsibles[j].start('height', '25px');
						}
					}			
			
				 // if (i != (zone-1))
				  {
				
					  if(list[i].getStyle('height').toInt() > 25){
						//hide
						collapsible.start('height', '25px');
						//span.setHTML('Lire la suite');
					  }else{
						//show
						collapsible.start('height', c1Height);
						//span.setHTML('Replier');
					  }
				  }
				   return false;
				}
				//collapsible.setStyle(’display','block’);
				var c1Height = list[i].getScrollSize().y;
			
				
			  	if (i == (zone-1))
			  	{
					list[i].setStyle('height', '100%');
			  	}	

				
			});
			


	
	
	}



});