/*******************************************************************************
 jdtabs
 A so-called "Web 2.0" Navigation bar, done in CSS2 with a Javascript cheat to
 allow the submenus to function. Graceful (but ugly) fallback for non-JavaScript
 browsers is supported.

 Use: See the navcss.css file for use. No need to set any event handlers in
 your HTML; they'll be set automatically when this js is loaded. Existing
 onload handlers will be preserved as well.
 ******************************************************************************/

/*==============================================================================
  placeSubmenus()
  This script looks for a DIV of ID=NavMarker, gets the tab number from the
  CLASS of that DIV, and looks for a DIV of ID=subNav+tab, and copies it into
  the DIV with the ID=subnavlocation.
 =============================================================================*/
function placeSubmenus() {
	if (!document.getElementById) return null;
	var attributeName = 'class';
	var isIE = /*@cc_on!@*/false;
	if (isIE) {attributeName = 'className';}
	var myTab = "subNav" + document.getElementById('NavMarker').getAttribute(attributeName);
	var myElement = document.getElementById(myTab);
	var myDest = document.getElementById("subnavlocation");
	var myNewElement = myDest.appendChild(myElement);
	myNewElement.style.display = "block";
	tickleIE();
}


// briefly resize the IE window to fix positioning bug
function tickleIE() {
	var isIE = /*@cc_on!@*/false;
	if (isIE) { // force IE to reflow the page for IE6 bug. Max'd windows won't work ::shrug::
		window.resizeBy(-1,-1);
		setTimeout("window.resizeBy(1,1);",200);
	}	
}


/*==============================================================================
  Once we're loaded:
  o load in the stylesheet. Stylesheet won't be loaded if there's no javascript.
  o make sure that placeSubmenus() will be called on page load.
 =============================================================================*/
document.write('<link rel="stylesheet" type="text/css" href="/css/jsdnavigation.css" />');
var old_onload = window.onload;
window.onload = placeSubmenus;
if(old_onload != null && typeof(old_onload) == 'function') { old_onload(); }
