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 wrapper = document.getElementById('wrapper'); 
	// asterisk pulls in all elements in this div
	var eNode=wrapper.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();
	  
	  for (i=0; i<eNode.length; i++) { 
		var eNodeID = eNode[i].id.toLowerCase();
		  //permanently show section menu if in that section
		    if (eNodeID.indexOf(lvlOne)!=-1) {
				if (eNodeID=='navlist_'+lvlOne) {
				 	eNode[i].className='show'; 
				}
				
				if (eNodeID=='nav_'+lvlOne) {
						if (lvlTwo=='none' ) {
							//add right arrow to list header
							eNode[i].firstChild.className='active';
						}else{
							//add down arrow to list header
				 			eNode[i].firstChild.className='open';
						}
				}		
			}
		  //highlight appropriate lvlTwo
		  if (lvlTwo!="none") {
				if (eNodeID=='navitem_'+lvlOne+'_'+lvlTwo) {
				 eNode[i].firstChild.className='active'; 

				 for (i3=0; i3<eNode[i].childNodes.length; i3++) { 
					if (eNode[i].childNodes[i3].nodeName=='UL') {
						eNode[i].childNodes[i3].className='show';	
					}

				 }
			  }
		  }
		  //highlight appropriate lvlThree
		  if (lvlThree!="none") {
			  	if (eNodeID=='navitem_'+lvlOne+'_'+lvlTwo) {
				 eNode[i].firstChild.className='subactive';
				}
			  	if (eNodeID.indexOf(lvlOne+'_'+lvlTwo+'_'+lvlThree)!=-1) {
				 eNode[i].firstChild.className='active'; 
				 
			 for (i2=0; i2<eNode[i].childNodes.length; i2++) { 
				 	if (eNode[i].childNodes[i2].nodeName=='UL') {
						eNode[i].childNodes[i2].className='show';	
					}
				 }
 
			  }
		  }
/*		  	//highlight appropriate lvlFour
		  if (lvlFour!="None") {
			  	if (eNode[i].id.indexOf(lvlFourLowerCase)!=-1) {
				 eNode[i].firstChild.className='active'; 
				}
		  }*/
		//hides divs if not active		  	
			if (eNodeID.indexOf('navlist_')!=-1 && eNode[i].className!='show' && eNode[i].className!='active' && eNodeID!='navlist_more') {
				eNode[i].className='hide';
			}
			if (eNodeID.indexOf('navsublist_')!=-1 && eNode[i].className!='show' && eNode[i].className!='active') {
				eNode[i].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[i].firstChild.onclick=toggleLists;
			}
		}

//Rotating Graphic
	if (document.getElementById('headerPhotos')) {
		numRandom = (Math.round((Math.random()*7))+1);
		document.getElementById('headerPhotos').innerHTML= "<img src='_images/rotation/" + numRandom + ".jpg' alt='Food Science and Human Nutrition Images' width='500' height='165' />"
	}
  
	

/* ****************************************
	Below: Adapted slightly 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 i5=0; i5<anchors.length; i5++) {
			var docLink = anchors[i5];
			if (docLink.className=='externalDocument' && docLink.parentNode.id.indexOf('navItem')==-1) {
				docLink.target = "_blank";
				docLink.innerHTML = docLink.innerHTML + "&nbsp;(opens in new window)";
				document.getElementById('pdfNote').className="show"; 
				}
			//show pdf note for navigation pdf only if it is visible
			if (docLink.className=='externalDocument' && docLink.parentNode.id.indexOf('navItem')!=-1) {
				if(docLink.parentNode.parentNode.className=="show") {
					docLink.target = "_blank";
					docLink.innerHTML = docLink.innerHTML + "&nbsp;(opens in new window)";
					document.getElementById('pdfNote').className="show";
				}
			}
			if (docLink.className=='externalDocumentNoNote') {
				docLink.target = "_blank";
			}
		}

/* END Onload 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');
	
	for (i4=0; i4<As.length; i4++) {
		
		if (As[i4].parentNode.id.substring(4)==sectionID)	{
				this.className='open';
		}else{
			As[i4].className='';
		}
	}
	
	
	for (i6=0; i6<ULs.length; i6++) {
		// reset classes
		ULs[i6].className='hide';
	
		if (ULs[i6].id.substring(8)==sectionID) {			
    			if (ULs[i6].className=='hide'){
					ULs[i6].className='show';
				}

			
		}
	}
}





