// JavaScript Document

function showCurrentSection(){
	/* Collapse all the sections */
	var nav = document.getElementById("leftnavbottom");
	nav.className += " js";
	
	
	/* Get the current directory */
	var path = document.location.pathname;
	var folders = path.split("/");
	folders.pop();
	var dir = folders[2]; //set dir to the 2nd directory
	if (!dir){
		var li = document.getElementById("section-home")
	} else{
		/* Find the link to the current directory */
		var links = nav.getElementsByTagName('a');
		for (var x = 0; x<links.length; x++) {
			var target = links[x].href;
			target = target.split("/");
			target.pop();
			target = target[target.length-1].toString();
			if(dir === target) {
				var element = links[x];
				while(element.id != 'leftnavbottom') {
					if (element.tagName=='LI'){
						var li = element;
					}
					element = element.parentNode;
				}
			}
		}	
	}
		
	/* Add the class */
	li.className += " current";
}

//used to call on page load
var addEvent = function( obj, type, fn ) {
        if (obj.addEventListener)
                obj.addEventListener(type, fn, false);
        else if (obj.attachEvent)
                obj.attachEvent('on' + type, function() { return fn.apply(obj, new Array(window.event));});
}

// Run on page load
//addEvent(window, "load", showCurrentSection);