// JavaScript Document
// Purpose to change classname's of the LI in the Navigation to show user active menu item

function changeActiveMenu() {

	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	//alert(sPage);
	
	if (sPage == "solutions" || sPage == "municipal-fixed-income" || sPage == "customization" || sPage == "taxable-fixed-income") {
		showHide("liSolutions");
	}
	if (sPage == "insights") {
		showHide("liInsights");
	}
	if (sPage == "team") {
		showHide("liTeam");
	}
	if (sPage == "service") {
		showHide("liService");
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function showHide(element_id) {
	if (document.getElementById && document.getElementById(element_id)) {
		var menu = document.getElementById(element_id);
		menu.className = "On";
	}
}

addLoadEvent(changeActiveMenu);
