/*	Expanding Menus uses jquery
 *
 *	Created by Roos Cairns Mar 2008 modified by NARVALO fineart Mar 2011
*/


function expandingMenu(num) {
	var speed = 1;
	
	var item_title = $("#menu ul").eq(num).children(":first");
	var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });
	$("#menu ul li.section-title").nextAll().hide(1);
	
	/* hide items if not active */
	if (items.is(".active") == false) {
		items.hide();
		
		$("#menu ul li.section-title").hover(function(){
$(this).nextAll().show();
});


	}
	
	
	if (items.is(".active") == false) {
		items.hide(1);
		
		$("#menu ul li.section-title").click(function(){
$(this).nextAll().hide(1);
});


	}
	
	
	if (items.is(".active") == true) {
		items.hide(1);
		
		$("#menu ul li.section-title").click(function(){
$(this).nextAll().hide(1);
});


	}
	
// First we hide all exhibitis $("#menu ul li.section-title").nextAll().hide();
// then the active exhibit is showed
$("#menu ul").each(function()
{
$(this).find("li.active").prevAll().nextAll().show();
});

// This is the toggle function

$("#menu ul li.section-title").hover(function()
{
$("#menu ul li.section-title").nextAll().hide();
$(this).nextAll().show(1);
});
$("#menu ul").click(function()
{
	$(this).find("li.active").prevAll().nextAll().hide(1);
});
}
