/**
 * jQuery script for the fancy slide menu
 */
$(document).ready(function(){
    // close all lists at load
    $(".gallery-collection-list").hide();

    // find, in the menu, the link(s) we are currently at and open them again
    $('#menu .gallery-collection-list a.active').parent().parent().show();

    // define the listener for the groupers
    $(".gallery-collection-grouper").click(function(){
      prev_open = $(".gallery-collection-list:visible");
      prev_open.slideUp("slow");
      // only slide down/open if this item was previously closed (allows to close all items)
      if(prev_open[0] != $(this).next()[0]){
        $(this).next().slideDown("slow");
      }
      return false;
    });
});
