
// Travis rewrite on 3/11/09 to hilight the correct main nav category
function initNavigation() {

	if (document.getElementById) { // Does the browser support the getElementById method?
		navRoot = document.getElementById("pmenu"); // Get main list ul

		if (typeof defaultMainList!="undefined") {
			var reMainNav = new RegExp("^" + defaultMainList + "<", "i"); // Regex for finding the index of the default main list item
		}
		// get the file name
		var loc = location.href;
		loc = loc.substring(loc.lastIndexOf("/")+1, loc.length);
		//alert(loc);
		for (i=0; i<navRoot.childNodes.length; i++) { // Loop over main list items
			node = navRoot.childNodes[i];
			//alert(node.nodeName);
			if (node.nodeName == "LI") {
				var txt = node.firstChild.getAttribute('href');
				txt = txt.substring(txt.lastIndexOf("/")+1, txt.length);
				//alert(txt);
				if (txt == loc) { // Found default main nav item in top menu
					defaultMainListIndex = i;
				} else { // maybe the page is in a submenu
					//alert(node.innerHTML);
					var liobj = node.getElementsByTagName("LI");
					//alert(liobj.length);
					for (var n=0; n<liobj.length; n++) {
						//alert(n);
						txt = liobj[n].firstChild.getAttribute('href');
						txt = txt.substring(txt.lastIndexOf("/")+1, txt.length);
						//alert(txt);
						if (txt == loc) { // Found default main nav item in top menu
							defaultMainListIndex = i;
						}
					}
				}
			}
		}

		//alert(defaultMainListIndex);

		if (defaultMainListIndex != -1) { // the A tag gets a new class
			navRoot.childNodes[defaultMainListIndex].childNodes[0].className = "enclose";
		}
	}
}

function tp_over(node) {
//alert("tp_over " + node.id);
  document.getElementById("tabpanel_1").className = ""; // De-activate default item
  node.className = "tabpanel_default"; // Activate the hovered item
}

function tp_out(node) {
//alert("tp_out " + node.id);
  node.className = ""; // De-activate this item
  document.getElementById("tabpanel_1").className = "tabpanel_default"; // Activate default item
}

function tp_click(node) {
//alert("tp_click " + node);
	for (i=1; i<10; i++) {
		obj = document.getElementById("tabpanel_" + i);
		if (obj != null) {
			if (i != node) {
				document.getElementById("tabpanel_" + i).className = "";
				//document.getElementById("tabpanel_" + i + "_sublist").display = "none";
			} else {
				document.getElementById("tabpanel_" + i).className = "tabpanel_default";
				//document.getElementById("tabpanel_" + i + "_sublist").display = "block";
			}
		}
	}
}

var defaultMainListIndex = -1; // Initialize the index of the default main list item

