// MSR 2007-10-05:
// Removed check for dept_name = "Navigation Name 10" as the name may be different
// Added FEATURE BEGIN and FEATURE END comments
// Added comments
function draw_leaf_tree(){
	var base_dept="10";
	var passed_base=false;
	
	// If the leaf_tree array exists and it has elements...
	if ((typeof(leaf_tree)!="nothing")&&(leaf_tree.length>0)){
	
		// Loop through the array backwards
		for (i=leaf_tree.length-1;i>=0;i--){
			// If we're past the base department...
			if (passed_base){
				// jat 9/24/08 - sup32820 - checking if the department name is "companies" to fix security issue. if companies department, do not display.
				if((leaf_tree[i].dept_name).toLowerCase() != "companies"){
					//seperator - getting here only after 2 levels deep to created bullet
					document.write("<span class=\"leaftreespacer\">&nbsp;&gt;&nbsp;</span>");
					
					// set class variable depending on if it's the last link in the tree or not.
					var tmpClass = (i == 0)? "leaftree2" : "leaftree";
					
					//link and name
					document.write("<a href=\"" + leaf_tree[i].dept_link + "\" CLASS=\"" + tmpClass + "\">" + leaf_tree[i].dept_name + "<\/a>");
				}
			}else{
			
				// If we're on the base department...
				if (leaf_tree[i].dept_id==base_dept){
				
					passed_base=true;
					//HOME link and HOME name
					document.write("<a href=\"default.asp\" class=\"leaftree\" onClick=\"return(visitargs('default.asp','','URL'));\">Home<\/a>");
					
				} //end if
			} //end if
		} // end for
		
		if(passed_base == false){
			// JAT 8/11/08 - put up a default leaftree if current dept is not part of the set root
			document.write("<a href=\"default.asp\" class=\"leaftree\" onClick=\"return(visitargs('default.asp','','URL'));\">Home<\/a>");
			// jat 9/24/08 - sup32820 - checking if the department name is "companies" to fix security issue. if companies department, do not display.
			if((leaf_tree[0].dept_name).toLowerCase() != "companies"){
			//seperator - getting here only after 2 levels deep to created bullet
				document.write("<span class=\"leaftreespacer\">&nbsp;&gt;&nbsp;</span>");
				document.write("<a href=\"" + leaf_tree[0].dept_link + "\" CLASS=\"leaftree\">" + leaf_tree[0].dept_name + "<\/a>");
			}
		}
		
	}// end if
} // end function

