;(function($) {
$(document).ready(function() {
/** -----------------------------------------------
* TABLE OF CONTENTS
*
* Transform a #table-of-contents div to a nested list
*/
if($("#content-column").length > 0) {
var toc = '
' +
'
Table of contents▼
';
// Remove existing anchor redirection in the url
var pageURL = window.location.href.replace(/#[a-zA-Z0-9\-\_]*/g, '');
$('#content-column h1[id], #content-column h2[id], #content-column h3[id], #content-column h4[id]').each(function(i) {
var current = $(this);
var tagName = current.prop("tagName");
if(typeof tagName == "String") tagName = tagName.toLowerCase();
toc += '- ' + current.html() + '
';
});
toc += '
';
// Table of content location
var title = $('#content-column h1:first');
if (title.length > 0) {
title.after(toc);
} else {
var breadcrums = $('#content-column #breadcrumbs');
if (breadcrums.length > 0) {
breadcrums.after(toc);
} else {
$('#content-column').prepend(toc);
}
}
// Toggle the TOC
$('#table-of-contents').attr('href', 'javascript:void()').toggle(
function() {
$("#toc").animate({'height':'show'}, 200, function(){$('#table-of-contents h4 span').html('▲');})
},
function() {
$("#toc").animate({'height':'hide'}, 200, function(){$('#table-of-contents h4 span').html('▼');})
}
);
// Make sure clicking a link won't toggle the TOC
$("#table-of-contents li a").click(function (e) { e.stopPropagation(); });
}
/** -----------------------------------------------
* SUBMENU
*
* move to separate menu block
*/
if ($("#submenu").length > 0) {
var submenu = '