$(document).ready(function(){

  $('#navv ul').each(function(i) {
    if ($.cookie('menuLabel-' + i)) { $(this).show(); } else { $(this).hide(); }
    $(this).prev().click(function() {
      $(this).parent().siblings().each(function() {
        $(this).find('ul').slideUp(1, function(){ $.cookie('menuLabel-' + $('#navv ul').index($(this)), null, { expires: null, path: '/' }); });
      });
      var n = $('#navv ul').index($(this).next());
      if ($(this).next().css('display') == 'none') {
        $(this).next().slideDown(200, function () {
          $.cookie('menuLabel-' + n, 'open', { expires: null, path: '/' });
        });
      } else {
        $(this).next().slideUp(200, function () {
          $.cookie('menuLabel-' + n, null, { expires: null, path: '/' });
        });
      }
      return false;
    });
  });
  if($.cookie('activeHref')) { $('#navv a[href*="' + $.cookie('activeHref') + '"]').addClass('active'); }
  $('#navv a[href*="folder="]').click(function(){
    $('#navv a[href*="folder="]').removeClass('active');
    $.cookie('activeHref', $(this).attr('href'), {expires: null, path: '/'});
    $(this).addClass('active');
  });

  $("a[rel='photo']").colorbox();
  
});

