function onloadFunctions(lvlOne, lvlTwo, lvlThree, lvlFour){ 

var columnMainHeight=document.getElementById('columnMain').offsetHeight;
	if (columnMainHeight<370) {
    	document.getElementById('columnMain').style.height=30 + 'em';
 	}	


// Left Menu
    var wrapperColumns = document.getElementById('wrapperColumns'); 
	// asterisk pulls in all elements in this div - older versions of Safari do not support this so menu will stay expanded in those versions
	var eNode=wrapperColumns.getElementsByTagName('*');
	// ids in this function are converted to lowercase so there are not case-sensitive issues if some creates an id with Caps in the wrong spot
	var lvlOne = lvlOne.toLowerCase();
	var lvlTwo = lvlTwo.toLowerCase();
	var lvlThree = lvlThree.toLowerCase();
	var lvlFour = lvlFour.toLowerCase();
    
	if (lvlOne!= 'sitemap') {
		for (i1=0; i1<eNode.length; i1++) { 
			var eNodeID = eNode[i1].id.toLowerCase();
		  	//permanently show section menu if in that section
				  if (eNodeID.indexOf(lvlOne)!=-1) {
						if (eNodeID=='navlist_'+lvlOne) {
							eNode[i1].className='show'; 
						}
						if (eNodeID=='nav_'+lvlOne && lvlTwo=='none' && lvlThree=='none') {
								//add right arrow to list header
								eNode[i1].firstChild.className='active';
						}else if (eNodeID=='nav_'+lvlOne) {
								//add down arrow to list header
								eNode[i1].firstChild.className='open';
						}
								
					}
				  //highlight appropriate lvlTwo
				  if (lvlTwo!="none") { 
						if (eNodeID=='navitem_'+lvlOne+'_'+lvlTwo) {
						 eNode[i1].firstChild.className='active'; 
		
						 for (i2=0; i2<eNode[i1].childNodes.length; i2++) { 
							if (eNode[i1].childNodes[i2].nodeName=='UL') {
								eNode[i1].childNodes[i2].className='show';	
							}
		
						 }
					  }
				  }
				  //highlight appropriate lvlThree
				  if (lvlThree!="none") {
						if (eNodeID=='navitem_'+lvlOne+'_'+lvlTwo) {
						 eNode[i1].firstChild.className='subactive';
						}
						if (eNodeID.indexOf(lvlOne+'_'+lvlTwo+'_'+lvlThree)!=-1) {
						 eNode[i1].firstChild.className='active'; 
						 
					 for (i3=0; i3<eNode[i1].childNodes.length; i3++) { 
							if (eNode[i1].childNodes[i3].nodeName=='UL') {
								eNode[i1].childNodes[i3].className='show';	
							}
						 }
		 
					  }
				  }
				   //highlight appropriate lvlFour in right menu
				  if (lvlFour!="none") {
						if (eNodeID.indexOf('navmoreitem_')!=-1 && eNodeID.indexOf(lvlFour)!=-1) {
						 eNode[i1].firstChild.className='active';
						}
				  }		  
			//hides divs if not active		  	
				if (eNodeID.indexOf('navlist_')!=-1 && eNode[i1].className!='show' && eNode[i1].className!='active' && eNodeID!='navlist_more') {
					eNode[i1].className='hide';
				}
				if (eNodeID.indexOf('navsublist_')!=-1 && eNode[i1].className!='show' && eNode[i1].className!='active') {
					eNode[i1].className='hide';
				}
			// run the function below when the main section link is clicked
				if (eNodeID.indexOf('nav_')!=-1) {
			// firstChild is A tag in the H3
					eNode[i1].firstChild.onclick=toggleLists;
				}
			}
		}
/* ****************************************
	Below: Adapted from http://www.brucelawson.co.uk/index.php/2005/opening-links-in-new-windows-in-xhtml-strict/#comment-376
**************************************** */
if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("A");
	/* hide PDF note by default */
	document.getElementById('pdfNote').className="hide"; 
		for (var i=0; i<anchors.length; i++) {
			var docLink = anchors[i];
			if (docLink.className=='externalDocument') {
				docLink.target = "_blank";
				docLink.innerHTML = docLink.innerHTML + "&nbsp;(opens in new window)";
				document.getElementById('pdfNote').className="show"; 
				}
			if (docLink.className=='externalDocumentNoNote') {
				docLink.target = "_blank";
			}
		}	

		
/* ****************************************
 Above: Adapted from http://www.brucelawson.co.uk/index.php/2005/opening-links-in-new-windows-in-xhtml-strict/#comment-376
**************************************** */		

/* END function */
}


function toggleLists() {
	// this is the A tag. Getting the name of the parent H3 here
	var sectionID = this.parentNode.id.substring(4);
	
 	var navGlobal = document.getElementById('navGlobal'); 
	
	var ULs=navGlobal.getElementsByTagName('UL');
	var As=navGlobal.getElementsByTagName('A');
	
	//Note - since this is a sub function of the onloadFunctions, Safari does not like the integer to have the same name - hence the 4 after the i
	for (i4=0; i4<As.length; i4++) {
		
		if (As[i4].parentNode.id.substring(4)==sectionID)	{
				this.className='open';
		}else{
			As[i4].className='';
		}
	}
	
	
	for (i5=0; i5<ULs.length; i5++) {
		// reset classes
		ULs[i5].className='hide';
	
		if (ULs[i5].id.substring(8)==sectionID) {			
    			if (ULs[i5].className=='hide'){
					ULs[i5].className='show';
				}

			
		}
	}
}

/* ****************************************
This script is from Roger Johansson at 456 Berea Street:  http://www.456bereastreet.com/archive/200505/transparent_custom_corners_and_borders/
**************************************** */
/*
addEvent function found at http://www.scottandrew.com/weblog/articles/cbs-events
*/


function addEvent(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}

/*
createElement function found at http://simon.incutio.com/archive/2003/06/15/javascriptWithXML
*/
function createElement(element) {
	if (typeof document.createElementNS != 'undefined') {
		return document.createElementNS('http://www.w3.org/1999/xhtml', element);
	}
	if (typeof document.createElement != 'undefined') {
		return document.createElement(element);
	}
	return false;
}

function insertTop(obj) {
	// Create the two div elements needed for the top of the box
	d=createElement("div");
	d.className="box-top"; // The outer div needs a class name
    d2=createElement("div");
    d.appendChild(d2);
	obj.insertBefore(d,obj.firstChild);
}

function insertBottom(obj) {
	// Create the two div elements needed for the bottom of the box
	d=createElement("div");
	d.className="box-bottom"; // The outer div needs a class name
    d2=createElement("div");
    d.appendChild(d2);
	obj.appendChild(d);
}

function initCB() {
	// Find all div elements
	var divs = document.getElementsByTagName('div');
	var cbDivs = [];
	for (var i = 0; i < divs.length; i++) {
	// Find all div elements with cbb in their class attribute while allowing for multiple class names
		if (/\bcbb\b/.test(divs[i].className))
			cbDivs[cbDivs.length] = divs[i];
	}
	// Loop through the found div elements
	var thediv, outer, i1, i2;
	for (var i = 0; i < cbDivs.length; i++) {
	// Save the original outer div for later
		thediv = cbDivs[i];
	// 	Create a new div, give it the original div's class attribute, and replace 'cbb' with 'box'
		outer = createElement('div');
		outer.className = thediv.className;
		outer.className = thediv.className.replace('cbb', 'box');
	// Change the original div's class name and replace it with the new div
		thediv.className = 'i3';
		thediv.parentNode.replaceChild(outer, thediv);
	// Create two new div elements and insert them into the outermost div
		i1 = createElement('div');
		i1.className = 'i1';
		outer.appendChild(i1);
		i2 = createElement('div');
		i2.className = 'i2';
		i1.appendChild(i2);
	// Insert the original div
		i2.appendChild(thediv);
	// Insert the top and bottom divs
		insertTop(outer);
		insertBottom(outer);
	}
}

if(document.getElementById && document.createTextNode)
{
	addEvent(window, 'load', initCB);
}

/* ****************************************
This script above is from Roger Johansson at 456 Berea Street:  http://www.456bereastreet.com/archive/200505/transparent_custom_corners_and_borders/
**************************************** */





