function closeBoxes(boxes)
{
	boxes.each(function(){
		toggleBox(this, false);
	});
}

function toggleBox(box, _switch)
{
	var title = $('h5', box);
	var content = $('.content', box);
	
	title.toggleClass('opened', _switch);
	title.toggleClass('closed', !_switch);
	
	if(_switch) content.show('fast');
	else content.hide('fast');
}

function initBoxes()
{
	var boxes = $('#ficheAnnonce div.infos div.foldedInfoBox');
	
	$(boxes).each(function(){
	
		var box = this;
		
		$('h5 a', box).click(function(event){
			event.preventDefault();
			var open = !$(this).parent('h5').hasClass('opened');
			closeBoxes(boxes);
			if (open) toggleBox(box, true);
		});
	
	});
}


$(document).ready( function() {

	if( typeof(ajaxRedirection)!='undefined' && ajaxRedirection==true )
		return;

	initBoxes();
	//_openFoldedInfoBoxAccordingToLocationHashIfNeeded();

} );

