$(document).ready(function() {
    initializeSideNav();
});

function initializeSideNav() {
    var selector = '.sidenav #sidenav-content'
    if ($(selector).length == 0) {
        console.log("No element matching selector " + selector + ". Nowhere to put the sidenav content! Returning.");
        return;
    }

    // figure out minimum header value (e.g., h3 is the largest)
    var uniqueHeaderIndices = [];
    $('.sidenav-anchor').each(function() {
        var header = $(this).children(':header').first();
        // http://stackoverflow.com/questions/5127017/automatic-numbering-of-headings-h1-h6-using-jquery
        var hIndex = parseInt(header.prop('nodeName').substring(1));
        if ($.inArray(hIndex, uniqueHeaderIndices) == -1) {
            uniqueHeaderIndices.push(hIndex);
        }
        uniqueHeaderIndices.sort();
    });

    // now put all the <h> elements under each sidenav-anchor into the sidenav
    $('.sidenav-anchor').each(function() {
        var header = $(this).children(':header').first();
        var hrefTarget = $(this).prop('id');
        var levelsDeep = $.inArray(parseInt(header.prop('nodeName').substring(1)), uniqueHeaderIndices);
        console.log(levelsDeep);

        var elem = "";
        for (var i=0; i<levelsDeep; i++) {
            elem += "<ul class='nav'><li>";
        }
        elem += '<a href="#' + hrefTarget + '">' + header.text() + '</a>';
        for (var i=0; i<levelsDeep; i++) {
            elem += "</li></ul>";
        }
        console.log(elem);

        $('#sidenav-content').append('<li>' + elem + '</li>');
    });
}
@@ -49,16 +49,217 @@
 eNav();%0A
+    var offset = 60;%0A%0A    $('#sidenav-content li a').click(function(event) %7B%0A        event.preventDefault();%0A        $($(this).attr('href'))%5B0%5D.scrollIntoView();%0A        scrollBy(0, -offset);%0A    %7D);%0A%0A
 %7D);%0A%0Afun
@@ -1790,8 +1790,9 @@
    %7D);%0A%7D
+%0A

fix logistic page ancor navigation bug