﻿// JScript File

var SetNav = {
	current: null,
	init: function () {
		SetNav.getCurrent();
		SetNav.getNavTags();
	},
	getCurrent: function () {
	    this.current = '/' + location.pathname.split('/')[1] + '/';
	},
	getNavTags: function () {
	    if(document.getElementById && document.createTextNode) { 
            var divs = document.getElementsByTagName("div"); 
            for(i=0;i<divs.length;i++) {
                if (divs[i].className=="menu") {
                    var lis = divs[i].getElementsByTagName("li");
                    for(j=0;j<lis.length;j++) {
                        if(lis[j].innerHTML.match(this.current) != null) {
                            lis[j].className = "current";
                        }
                    }
                }
            }
        }
    }
};

window.onload = SetNav.init;