	function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }

}

function enableEnlarge() {
	// dynamically create and add the enlargebutton
	var allDivs = document.getElementsByTagName('div');
	for (i = 0; i < allDivs.length; i++) {
		if (allDivs[i].className.indexOf('enlargeImage') != -1) {
			var btnTxt = document.createTextNode('Enlarge Chart');
			var btnDiv = document.createElement('div');
			btnDiv.appendChild(btnTxt);
			btnDiv.className = 'enlargeButton imageReplace';
			btnDiv.onclick = enlarge;
			allDivs[i].appendChild(btnDiv);
		}
	}
	// link the refs to the popup script
	var allAs = document.getElementsByTagName('a');
	for (i = 0; i < allAs.length; i++) {
		if (allAs[i].className.indexOf('refPop') != -1) {
			allAs[i].onclick = function() {
				MM_openBrWindow(this.getAttribute('href'),'References','width=500,height=400,scrollbars=yes');
				return false;
			}
		}
	}
}


// get dimensions of page. Credit to Codylindley.com

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}



// Show enlarged image in lightbox

function enlarge() {
	// find existing login pop-up for later use
	// var existingPop = document.getElementById('pop');
	var existingPop = document.getElementById('internaluserpop');
	// create the close button for the enlarged image dynamically
	var closeButton = document.createElement('img');
	closeButton.className = 'hand_cursor closeButton';
	closeButton.setAttribute('align', 'absmiddle');
	closeButton.onclick = enlarge;
	closeButton.setAttribute('alt', 'Close');
	// use the same image source for the close button as the login lightbox
	var popCloseButton;
	// find the img in the login lightbox
	var allImages = existingPop.getElementsByTagName('img');
	for (i = 0; i < allImages.length; i++) {
		if (allImages[i].className.indexOf('hand_cursor') != -1) popCloseButton = allImages[i];
	}
	// set src of graphic to the same
	closeButton.setAttribute('src', popCloseButton.getAttribute('src'));
	// make sure the target is the containing DIV and not the close button
	var target = this;
	while (target.nodeName.toLowerCase() != 'div' || target.className.indexOf('enlargeImage') == -1) {
		target = target.parentNode;
	}
	// create a hidden input tag as a toggle for showing or hiding this lightbox
	if (!document.getElementById('dispBox')) {
		var inputDispBox = document.createElement('input');
		inputDispBox.setAttribute('id', 'dispBox');
		inputDispBox.setAttribute('type', 'hidden');
		inputDispBox.setAttribute('value', 'false');
		target.appendChild(inputDispBox);
	} else {
		document.getElementById('dispBox').setAttribute('value', 'true');
	}
	var dispBox = document.getElementById('dispBox');
	// find the DIVs within the container, really looking for ImagePop
	var allDivs = target.getElementsByTagName('div');
	for (i = 0 ; i < allDivs.length; i++) {
		// if flag is set to "true", hide the lightbox and change the flag 
		if (allDivs[i].className.indexOf('imagePop') != -1) {
			if (dispBox.value.toLowerCase().indexOf('true') != -1) {
				var allImages = target.getElementsByTagName('img');
				for (j = 0; j < allImages.length; j++) {
					// remove the close button so that if the image is reopened we do not have multiple buttons
					if (allImages[j].className.indexOf('hand_cursor') != -1) allImages[j].parentNode.removeChild(allImages[j]);
				}
				allDivs[i].style.display="none";
				// hide the gray box behind the lightbox
				document.getElementById('pop1License').style.display='none';
				// remove the hidden input used for a flag
				dispBox.parentNode.removeChild(dispBox);
			}else{ // if we are displaying the enlarged image
				// add the closebutton at the top
				allDivs[i].insertBefore(closeButton, allDivs[i].firstChild);
				allDivs[i].style.display="block";
				// show the gray box behind the lightbox
				document.getElementById('pop1License').style.display="block";
				// expand the gray box behind the lightbox to 
				document.getElementById('pop1License').getElementsByTagName('img')[0].style.height=getPageSizeWithScroll()[1] + 'px';
				dispBox.value = 'true';
			}
		}
	}
}




// For the ISI Standards links in the About Page
	function showNav(){
		var divToToggle = document.getElementById('piNavSection');
		divToToggle.style.display='block';

		var tagToToggle = document.getElementById('menuPlusMinus');
		tagToToggle.className='menuHeader_minus';
	}
