// JavaScript Document
// JavaScript Document

/* To make it work: -----------------------------------------------------
|		your body tag should look like: <body onload="setActive();">
|
| 		also, set nav(below) to the container of your navigation
|
|		lastly, tell what the class name should be for the active link
|
|		that is all....
|
------------------------------------------------------------------------ */
// Set active link based on the current page url

// Nav div id
var nav = 'nav';

// Class name to append..
var active = 'active';

setActive = function() {
	var eles = document.getElementById(nav).getElementsByTagName("A");
	var thePage = window.location.pathname.split('/');
	var thisPage = thePage[thePage.length-1];
	for (var i=0; i<eles.length; i++) {
		var thisHref = eles[i].href.split('/');
		var theMatch = thisHref[thisHref.length-1]; 
		if(theMatch== thisPage) {
			eles[i].className +=" "+active;	
		}
	}
}
