$(document).ready(function(){
	
//Set default open/close settings
$('.acc_container').hide(); //Hide/close all containers
var ancora_log =$.url.attr("file");

if (ancora_log=="corsi-formazione.htm")
$('.post_active').removeClass('post_active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
else
$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('.acc_trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		
		$('.acc_trigger').removeClass('active').removeClass('post_active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
		var attuale_acc = $(this).attr("id").split("_");
		var nuovo_id = attuale_acc[0]+"_"+(eval(attuale_acc[1])+1);
		$("#"+nuovo_id).addClass("post_active");
	}
	return false; //Prevent the browser jump to the link anchor
});

});
