// ----------------------------------------------------------------------
// Detect DOM capabilities and set global DOM variables
// ----------------------------------------------------------------------

var isNS4 = false;
var isIE4 = false;
var isW3C = false;
var displayNav = "";
var topNavItem = "";
var toggle = false;
var ovrImages = new Array();
ovrImages["serv"] = "images/nav_serv_on.gif";
ovrImages["client"] = "images/nav_client_on.gif";
ovrImages["fin"] = "images/nav_fin_on.gif";
ovrImages["test"] = "images/nav_test_on.gif";
ovrImages["tools"] = "images/nav_tools_on.gif";

if (document.layers) {  // NS 4 proprietary DOM
	isNS4 = true;
	docObj = "document.";
	styleObj = "";
	}
else if (document.all && !document.getElementById) { // IE 4 proprietary DOM
	isIE4 = true;
	docObj = "document.all.";
	styleObj = ".style";
	}
else if (document.getElementById && document.all) { // W3C standards-compliant DOM
	isW3C = true;
	docObj = "document.getElementById('";
	styleObj = "').style";
	}
else if (document.getElementById) { // W3C standards-compliant DOM
	isW3C = true;
	docObj = "document.getElementById('";
	styleObj = "').style";
	}
	
window.onload = function () { 
	relightInitialNavs(); 
	
	var overImg = document.getElementsByTagName('img');
	for (var i=0; i<overImg.length; i++) {
		if (overImg[i].className.search('mouseover') != -1) {
			overImg[i].onmouseover = function(){this.src = this.src.replace('_off.gif','_on.gif');}
			overImg[i].onmouseout = function(){this.src = this.src.replace('_on.gif','_off.gif');}
		}
	}
	overImg = document.getElementsByTagName('input');
	for (var i=0; i<overImg.length; i++) {
		if (overImg[i].className.search('mouseover') != -1) {
			overImg[i].onmouseover = function(){this.src = this.src.replace('_off.gif','_on.gif');}
			overImg[i].onmouseout = function(){this.src = this.src.replace('_on.gif','_off.gif');}
		}
	}
	
	var expand = document.getElementsByTagName('div');
	for (var i=0; i<expand.length; i++) {
		if (expand[i].className.search('expandable') != -1) {
			var thePlusMinus = document.createElement('div');
			thePlusMinus.className = 'plus';
			expand[i].getElementsByTagName('h5')[0].appendChild(thePlusMinus);
			expand[i].getElementsByTagName('h5')[0].getElementsByTagName('div')[0].onclick = function() {
				if (this.className == 'plus') {
					this.className = 'minus';
					this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'block';
				}
				else {
					this.className = 'plus';
					this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none';
				}
			}
		}
	}
}
