nb = {

    init: function()
    {
        // Sidebar menu links
        nb.sidebar.init();
        nb.projects.init();
    },


    /**
     * Northbank sidebar open/close
     *
     */
    sidebar: {

        init: function() {
            $('#sidebar-menu li ul').hide();

            $('#sidebar-menu li:has(ul)').addClass('hasChild');

            // Determine active status
            $('#sidebar-menu li.active ul').show().addClass('opened');

            //$(window).scroll(function() {
            //    $('#sidebar').stop().animate({"marginTop": ($(window).scrollTop()) + "px"}, 250);
            //});

            //if($('.project-detail-text').length > 0) {
            //    el = $('.project-detail-text');
            //    el.css('position', 'fixed'); // Change to fixed
            //    el.after($('<div>').height(el.height() + 30)); // Insert a div to keep the spacing.
            //}
        }

    },

    projects: {
        init: function() {
            $('.detail-button a').click(function(e) {
                if($(this).html() == 'Details') {
                    $('.details-drop').show();
                    $('.project-detail-text').addClass('open');
                    $(this).html('Back');
                } else {
                    $('.details-drop').hide();
                    $('.project-detail-text').removeClass('open');
                    $(this).html('Details');
                }
                
                e.preventDefault();
            });
        }
    }

};


$(function(){nb.init();});

