function AddOnload(myfunc)
{
if(window.addEventListener)
window.addEventListener('load', myfunc, false);
else if(window.attachEvent)
window.attachEvent('onload', myfunc);
}

var activeMainNav = null;
var activeMainNavOn = null;
var thisActiveSub = null;
var thisActiveSubSub = null;
var thisActiveDiv = null;
var thisActiveDivNum = null;

//Nav positioners!
var extraPixels = 0;
IE7=(navigator.userAgent.toLowerCase().indexOf('msie 6') == -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') != -1);
if(IE7){extraPixels = 307;} 
function positionLayers(){
	document.getElementById("ddNav1").style.left=(document.getElementById("nav1").offsetLeft-22+extraPixels) + 'px';
	document.getElementById("ddNav2").style.left=(document.getElementById("nav2").offsetLeft-22+extraPixels) + 'px';
	document.getElementById("ddNav3").style.left=(document.getElementById("nav3").offsetLeft-22+extraPixels) + 'px';
	document.getElementById("ddNav4").style.left=(document.getElementById("nav4").offsetLeft-22+extraPixels) + 'px';
	document.getElementById("ddNav5").style.left=(document.getElementById("nav5").offsetLeft-22+extraPixels) + 'px';
	document.getElementById("ddNav6").style.left=(document.getElementById("nav6").offsetLeft-22+extraPixels) + 'px';
	if(IE7){extraPixels = 482;} 
	//was 387
	document.getElementById("ddDirectory").style.left=(document.getElementById("directoryNav").offsetLeft+extraPixels) + 'px';
}

function setSideNavHeight(){
	var thisHeight = document.getElementById('subSubViewport').offsetHeight;
	var thatHeight = document.getElementById('subSubNavigation').offsetHeight;
	var headerHeight = document.getElementById('theLogo').offsetHeight;
	var footerHeight = document.getElementById('theFooter').offsetHeight;
	
	//var thePageHeight = document.body.clientHeight - headerHeight;
	//why twice?
	var thePageHeight = getWindowHeight() - 137 - 45;
	if(thePageHeight < thisHeight) {
		
		//alert('page' + thePageHeight);
		//alert('this' + thisHeight);
		thePageHeight = thisHeight;
		//alert('in');
	}
	
	/*if(thisHeight > thatHeight) {
		document.getElementById('subSubNavigation').style.height = thisHeight + 'px';
	} else {
		document.getElementById('subSubNavigation').style.height = thatHeight + 'px';
	}
	*/
	document.getElementById('subSubNavigation').style.height = thePageHeight + 'px';
	//document.getElementById('subSubContentText').style.height = thePageHeight + 'px';
	
	//alert("pagde:" + document.getElementById('subSubNavigation').style.height);
	//alert("window:" + getWindowHeight());
	//alert(footerHeight);
	
}
function setSideNavHeightAwards(){
	var thisHeight = document.getElementById('subSubViewport').offsetHeight;
	var thatHeight = document.getElementById('subSubNavigation').offsetHeight;
	var headerHeight = document.getElementById('theLogo').offsetHeight;
	var footerHeight = document.getElementById('theFooter').offsetHeight;
	
	var thePageHeight = document.body.clientHeight - headerHeight;
	//why twice?
	var thePageHeight = getWindowHeight() - 137 - 45;
	//alert("content" + document.getElementById('subSubViewport').offsetHeight);
	var currentHeight = document.getElementById('subSubNavigation').style.height;
	currentHeight = currentHeight.replace("px","")
	document.getElementById('subSubNavigation').style.height = thePageHeight + 'px';
	document.getElementById('subSubNavigation').style.height = (document.getElementById('subSubViewport').offsetHeight - 25) + 'px';
}
//will need to touch this height up...
function setContactHeight(thePanel){
	var thisHeight = document.getElementById('subSubViewport').offsetHeight;
	if(thePanel == ''){
		var panelHeight = document.getElementById('subSubViewport').offsetHeight;
	   } else {
	var panelHeight = document.getElementById(thePanel).offsetHeight;
	   }
	var thatHeight = document.getElementById('subSubNavigation').offsetHeight;
	var headerHeight = document.getElementById('theLogo').offsetHeight;
	var footerHeight = document.getElementById('theFooter').offsetHeight;
	
	if(thisHeight < panelHeight){
		thisHeight = panelHeight +20;
	}
	//alert(document.getElementById('subSubNavigation').style.height);
	var thePageHeight = getWindowHeight() - 391 - 155;
	if(thePageHeight < thisHeight) {
		//alert(thisHeight);
		thePageHeight = thisHeight;
	}
	
	/*if(thisHeight > thatHeight) {
		document.getElementById('subSubNavigation').style.height = thisHeight + 'px';
	} else {
		document.getElementById('subSubNavigation').style.height = thatHeight + 'px';
	}
	*/
	//document.getElementById('subSubNavigation').style.height = thePageHeight + 'px';
	//document.getElementById('subSubContentText').style.height = thePageHeight + 'px';
	
	//alert("pagde:" + document.getElementById('subSubNavigation').style.height);
	//alert("window:" + getWindowHeight());
	//alert(footerHeight);
	
}

function getWindowHeight() {
var windowHeight=0;

if (document.documentElement&&
	document.documentElement.clientHeight) {
	windowHeight=document.documentElement.clientHeight;
}else {
	if (document.body&&document.body.clientHeight) {
		windowHeight=document.body.clientHeight;
	}else{
		if (typeof(window.innerHeight)=='number') {
			windowHeight=window.innerHeight;
		}
	}
}
return windowHeight;
}


//this is now generated!
/*
function setActiveNav(){
	//This sets the active icon - this is currently static on leadershipteam.. I will make this dynamic soon!!! - and likely give it it's own function!
	document.getElementById('activeIcon1On').style.top = (document.getElementById('ddNavItem13').offsetTop -2) + 'px';
	//document.getElementById('activeIcon1On').style.visibility = 'visible';
	thisActiveSub = "ddNavItem13";	
}
*/


// alert(document.getElementById("mainNav1").offsetLeft);
function show(elem){
	//alert(elem);
//alert(document.getElementById(elem).style.top);
  document.getElementById(elem).style.visibility="visible";
  if(elem != "theHider"){
  	show("theHider");
  }
 /*This sets the active icon - this is currently static on leadershipteam.. I will make this dynamic soon!!! - */
  //if(elem == "ddNav1"){
	//alert(thisActiveDivNum);
	///alert(thisActiveDiv);
	if(thisActiveSub != null){
		if(thisActiveDiv == elem){
		eval("document.getElementById('activeIcon" + thisActiveDivNum + "On')").style.visibility = 'visible';	
		}
	 //document.getElementById('activeIcon2On').style.visibility = 'visible';
	 }
 // }
  
  if(elem == "ddDirectory"){
  	 if(document.getElementById("theDirectoryTable").className == "directoryTable"){
	 	document.getElementById("theDirectoryTable").className="directoryTableOn";
	 } else {
		 document.getElementById("theDirectoryTable").className="directoryTableOn_fr";
	 }
  }
}
function hide(elem){
  document.getElementById(elem).style.visibility="hidden";
}
function toggleLayer(elem){
	if(document.getElementById(elem).style.visibility == "hidden"){
		document.getElementById(elem).style.visibility="visible";
	} else {
		document.getElementById(elem).style.visibility="hidden";
	}
}

//hideAllNav - will be generated
/*
function hideAllNav(thisNav){
	if(thisNav!=1){
	 document.getElementById('ddNav1').style.visibility="hidden";
	 document.getElementById('activeIcon1').style.visibility="hidden";
	 document.getElementById('activeIcon1On').style.visibility = 'hidden';
	}
	if(thisNav!=2){
	 document.getElementById('ddNav2').style.visibility="hidden";
	 document.getElementById('activeIcon2').style.visibility="hidden";
	}
	if(thisNav!=3){
	 document.getElementById('ddNav3').style.visibility="hidden";
	 document.getElementById('activeIcon3').style.visibility="hidden";
	}
	if(thisNav!=4){
	 document.getElementById('ddNav4').style.visibility="hidden";
	 document.getElementById('activeIcon4').style.visibility="hidden";
	}
	if(thisNav!=5){
	 document.getElementById('ddNav5').style.visibility="hidden";
	 document.getElementById('activeIcon5').style.visibility="hidden";
	}
	if(thisNav!=6){
	 document.getElementById('ddNav6').style.visibility="hidden";
	 document.getElementById('activeIcon6').style.visibility="hidden";
	}
	//begin - Directory DD
	document.getElementById('ddDirectory').style.visibility="hidden";
	document.getElementById('activeIconDir').style.visibility="hidden";
	document.getElementById("theDirectoryTable").className="directoryTable";
	//end - Directory DD
	document.getElementById('theHider').style.visibility="hidden";
	//alert(activeMainNav);
	if(activeMainNav != null && activeMainNav != activeMainNavOn){
		activeMainNav.className = 'mainNavLink';
	}
}
*/

function showIcon(theLink,theNav) {
	//alert(document.getElementById('activeIcon1').top);
	eval("document.getElementById('activeIcon" + theNav + "')").style.top = (theLink.offsetTop -2) + 'px';
	eval("document.getElementById('activeIcon" + theNav + "')").style.visibility = 'visible';
	//alert(theLink.offsetTop);
	
	/*This sets the active icon - this is currently static on leadershipteam.. I will make this dynamic soon!!! - */
	
	/*
	if(theNav == 1){
		 if(thisActiveSub != null){
		document.getElementById('activeIcon1On').style.visibility = 'visible';
		 }
	}*/
}
function showIconDir(theLink,theNav,theGroup) {
	//alert(document.getElementById('activeIcon1').top);
	var thisOffset = eval("document.getElementById('" + theGroup + "')").offsetTop;
	eval("document.getElementById('activeIcon" + theNav + "')").style.top = (theLink.offsetTop + thisOffset - 2) + 'px';
	eval("document.getElementById('activeIcon" + theNav + "')").style.visibility = 'visible';
	//alert(eval("document.getElementById('" + theGroup + "')").offsetTop);
}
function showIconSide(theLink,theNav) {
	//alert(document.getElementById('activeIcon1').top);
	document.getElementById('activeIconSide').style.top = (theLink.offsetTop + 2) + 'px';
	document.getElementById('activeIconSide').style.visibility = 'visible';
	//alert(theLink.offsetTop);
}


function hideIconSide(theNav){
	document.getElementById('activeIconSide').style.visibility = 'hidden';
}
function showActive(theMainLink){
	theMainLink.className = 'mainNavLinkOn';
	activeMainNav = theMainLink;
}


function preloadimages() {
	var arrayOfImages = new Array();
	arrayOfImages.push('images/home/counters1.png','images/home/counters2.png','images/home/counters3.png','images/home/counters4.png')
    for(i=0;i<arrayOfImages.length;i++){
		(new Image()).src = arrayOfImages[i];
    }
}

// -- BEGIN - Change Image
 function changeImage(imgDocID,imgObjName,layerName) {
      if (document.layers && layerName) {
      	      if(window.document.layers[layerName].document.images[imgDocID]){
       	      	window.document.layers[layerName].document.images[imgDocID].src = (imgObjName);
       	      } else {
       	      	document.getElementById(imgDocID).src = (imgObjName);
	      }
      }
      else {
	      if(document.images[imgDocID]){
	      	document.images[imgDocID].src = (imgObjName);
	      } else {
	      	document.getElementById(imgDocID).src = (imgObjName);
	      }
      }
	  //alert(document.images[imgDocID])
    }
// -- END - Change Image'

