function addSubNavListeners() {
  // Get the links.
  var navlnks = document.getElementById('nav_case').getElementsByTagName("a");
  // Run through the links
  for (e = 0; e < navlnks.length; e++) {
	// Find the ones desired that have subnavs.
	if ((navlnks[e].className == 'nav_bar') || (navlnks[e].className == 'nav_currpage')) {
	  // Get the link.
	  var lnk = navlnks[e];
	  // When you mouse over it, the subnav appears.
	  if (window.addEventListener) {lnk.addEventListener('mouseover', subnavOn, false);}
	  else {lnk.setAttribute('onmouseover', 'iesuckssubnavOn(this)');}
	}
  }
  // When you mouse off, the subnav disappears.
  if (window.addEventListener) {
	document.getElementById('headspace').addEventListener('mouseover', subnavOff, false);
	document.getElementById('banner_space').addEventListener('mouseover', subnavOff, false);
  }
  else {
	document.getElementById('headspace').setAttribute('onmouseover', 'subnavOff()');
	document.getElementById('banner_space').setAttribute('onmouseover', 'subnavOff()');
  }
}
if (window.addEventListener) {window.addEventListener('load', addSubNavListeners, false);}
 else {addSubNavListeners();}


function fixBars() {
  // And fix the dividers.
  var dvdrs = document.getElementById('corpus').getElementsByTagName('div');
  for (e = 0; e < dvdrs.length; e++) {
	if (dvdrs[e].className == 'corpus_spacer') {
	  //dvdrs[e].style.height = (document.getElementById('pole').offsetHeight - 30) + 'px';
	}
  }
}




function subnavOn() {
  var csn = document.getElementById('currsubnav');
  if (document.getElementById(csn.value + '_subnav_case')) {
	document.getElementById(csn.value + '_subnav_case').style.display = 'none';
  }
  csn.value = this.id;
  if (document.getElementById(this.id + '_subnav_case')) {
	document.getElementById(this.id + '_subnav_case').style.display = 'block';
  }
}
function subnavOff() {
  var csn = document.getElementById('currsubnav');
  var cp = document.getElementById('currpage');
  if (document.getElementById(csn.value + '_subnav_case')) {
	document.getElementById(csn.value + '_subnav_case').style.display = 'none';
  }
  csn.value = cp.value + '_lnk';
  if (document.getElementById(cp.value + '_lnk_subnav_case')) {
	document.getElementById(cp.value + '_lnk_subnav_case').style.display = 'block';
  }
}
function iesuckssubnavOn(obj) {
  var csn = document.getElementById('currsubnav');
  if (document.getElementById(csn.value + '_subnav_case')) {
	document.getElementById(csn.value + '_subnav_case').style.display = 'none';
  }
  csn.value = obj.id;
  if (document.getElementById(obj.id + '_subnav_case')) {
	document.getElementById(obj.id + '_subnav_case').style.display = 'block';
  }
}
