+// Create the responsive menu.
+austlii.menu = function() {
+ // wrap the source body content in a container
+ $("body").children().wrapAll('<div id="container" />');
+
+ // create and prepend menu to the page
+ var $menu = $('<div id="menu"></div>');
+ $('<h2>'+ $("h2").first().html() +'</h2>').prependTo($menu); // add header
+ $('img[alt="AustLII"]').detach().prependTo($menu);
+ $menu.prependTo("body");
+
+ // create and insert links in the menu
+ var $links = $('<ol />');
+ // headnote
+ $links.append('<li><a href="#top">Headnote</a><span class="spacer">·</span></li>')
+ // judgments
+ var $judges = $("a.section").slice(1,-1);
+ $judges.each(function(i){
+ var li = '<li><a href="#' + this.name + '">' + $(this).html().slice(0,-1) + '</a>';
+ if ( i < $judges.length )
+ li += '<span class="spacer">·</span>'
+ li += '</li>';
+ $links.append(li);
+ });
+ // footnotes
+ $links.append('<li><a href="#fn1">Footnotes</a></li>');
+ $menu.append($links);
+
+ // add annotation features
+ //$menu.append($('<a id="trigger-highlight" href="#">Highlight</a>'));