// Finds the documents filename before any underscores and adds that as id attrib to the body tag for CSS targeting.
var url = document.URL;
var DocName =(url.substring(url.lastIndexOf("\\")+1,url.lastIndexOf("\."))) // for windows
var DocName =(url.substring(url.lastIndexOf("\/")+1,url.lastIndexOf("\."))) // for *nix
var fulldocname = DocName;
var level3name = DocName;
var underscorepos = DocName.indexOf("_");
var underscore2 = (fulldocname.indexOf("_",underscorepos+1)); //finds the second instance of _
var underscore3 = (fulldocname.indexOf("_",underscore2)); //finds the third instance of _
if (underscorepos != "-1" ){
	var DocName =(DocName.substr(0,underscorepos));
	}
if (underscore2 != "-1" ){ //if there is another _ sets fulldocname to shortened string
	var fulldocname = (fulldocname.substr(0,underscore2)); 
	}
if (underscore3 != "-1" ){
	var level3name = (level3name.substr(underscore2,underscore3)); 
}		

$(document).ready(function() {
	$("body").attr({ id: DocName }); //sets the body id to the root section
	$("#"+DocName+" li."+DocName).css({ "font-weight":"bold" }); //bolds the section
	$("#"+DocName+" div#left_nav ul li."+DocName+" div.left_nav2").css({ display:"block" }); //this expands the menu
	$("#"+DocName+" div#left_nav ul li."+DocName+" div.left_nav2 li."+fulldocname).css({ "background-color":"#F3F3F3" }); 
	$("#"+DocName+" div#left_nav ul li."+DocName+" div.left_nav2 ul li."+fulldocname+" div.left_nav3").css({ display:"block" }); //this expands 3rd level menus
	$("#"+DocName+" div#left_nav ul li."+DocName+" div.left_nav2 ul div.left_nav3 li."+fulldocname+level3name).css({ "background-color":"#F3F3F3" }); 

});



