// JavaScript Document

//First we hide all exhibits
$("#menu ul li.section-title").nextAll().hide();

// This is the toggle function
// first it hides all sections
/*$("#menu ul li.section-title").hover(function()
{
$("#menu ul li.section-title").nextAll().hide();
$(this).nextAll().slideToggle("normal");
});*/

// then the active exhibit is showed
$("#menu ul").each(function()
{
$(this).find("li.active").prevAll().nextAll();
});

function expandingMenu(num) {
  var speed = 500;  
  var item_title = $("#menu ul").eq(num).children(":first");
  var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });
  
  /* hide items if not active*/ 
  if (items.is(".active") == false) {
	  items.hide();
  }

	/* add click functions + pointer to title */
	item_title.css({cursor:"pointer"}).toggle(
		function () {
			items.show(speed);
		}, function () {
			items.hide(speed);
		}
	)
}



function ndxz_expanding_loader() {
   var speed = 100;
   var item_title = new Array();
   var items = new Array();
   var i = 1;
   $("#menu ul").each(function()
   {
	   items[i] = $("#menu ul").eq(i).children().filter(function (index) { return index > 0; });
	  /* v1 - hide items if not active */
	  if (items[i].is(".active") == false) { items[i].hide(); }
	   /* v3 - hide all */
		//items[i].hide();
		 // apply the clicker
	   $(this).attr('id', 'c' + i);
	  $(this).children(":first").attr('onclick', "$('ul#c" + i + " li:gt(0)').toggle(" + speed + ");");
	  i++;
	 });
 }

