// Menu object for controlling the shop navigation

// Initialise on DOM ready
$(function() {
    // Toggle 'selected' for categories in active path
    for (i = 0; i < active_path.length; i++){
        id = parseInt(active_path[i], 10);
        if (id != NaN){
            $('ul#shop-navigation li#' + id).addClass('selected');
        }

    }
    
    //Remove any links to current page
    to_be_unlinked = $('#shop-navigation a[href=' + window.location.pathname + ']').contents();
    to_be_unlinked.unwrap();
    to_be_unlinked.wrap('<span></span>');
    
    //Set up category headings to toggle their subcategories
    // toggles = $('#shop-navigation ul .subcategory-toggle');
    // toggles.addClass('expands');
    // toggles.click(function()
    // {
    //     $(this).siblings('.subcategories').toggle('fast');
    //     $(this).parent().toggleClass('selected');
    //     return false;
    // });
    
    //Hide all non-selected subcategories
    $('#shop-navigation ul li:not(.selected) ul').hide();
    
    //Fade out notification messages after a short delay
    setTimeout(function(){ $('.notification').hide('slow'); }, 10000);
});

