var section = 'home';
//global 'on' color
onColor = '#ffc423';


function pageOn() {

		//get pagename
		l = document.location.href;
		l.toString();
		b = l.lastIndexOf('/')+1;
		dl = l.lastIndexOf('.');
		dl = l.length-dl;
		e = l.length-dl;
		l = l.substring(b,e);
		
		//current directory	stuff
		c = 0;	
		cs=new Array();
		
		//change style of hyperlinks to current page anywhere on the page
		
		//the next two lines set up what we're checking here: if it's IE we can just run through all the objects in the document and check out their properties.  If it is something standards based, like Firefox, we have to use document.anchors, and also we have to make sure to name our links so we can find them (even thought we aren't USING the name to find them (argh!).  In other words, the script will work in ie with or without named links, but needs the names for the others
		
		if (document.all) {itot = document.all.length} else {itot = document.anchors.length};
		if (document.all) {all = document.all} else {all = document.anchors};
		
		js = new Array();
		cnt = 0;
				
		for (i=0;i<itot;i++) {
			if(all[i].href) {
				lin = all[i].href;
				if(lin==document.location.href) {
					all[i].style.color = onColor;
					};
			}
			
			//while we're at it, build an array of all hidden nav lists (subsections) called "js"
			/*if(all[i].id) {
				j = all[i].id;
				if (j.indexOf('sb')>=0) {
					js[cnt]=j;
					cnt=cnt+1;
				}
				
			};*/
			
			}
	}
			

/****************************************************
*	        DOM Image rollover:
*		by Chris Poole
*		http://chrispoole.com
*               Script featured on http://www.dynamicdrive.com
*		Keep this notice intact to use it :-)
****************************************************/

function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
  	pageOn();
	sectionOn();
}



function sectionOn() {
	//turn on current section
	
	if(section) {
		if (section=='Lab') {
			document.images[section].src = 'images/navLabOn.gif';
			document.images[section].hsrc = 'images/navLabOn.gif';
			}
		if (section=='Research') {
			document.images[section].src = 'images/navResearchOn.gif';
			document.images[section].hsrc = 'images/navResearchOn.gif';
			}
		if (section=='EducationTraining') {
			document.images[section].src = 'images/navEducationTrainingOn.gif';
			document.images[section].hsrc = 'images/navEducationTrainingOn.gif';
			}
		if (section=='Center') {
			document.images[section].src = 'images/navCenterOn.gif';
			document.images[section].hsrc = 'images/navCenterOn.gif';
			}
		if (section=='About') {
			document.images[section].src = 'images/navAboutOn.gif';
			document.images[section].hsrc = 'images/navAboutOn.gif';
			}
	}
}

window.onload = init;

function Popper(URL,Width,Height,Left,Top,Resizable,Scrollbars) {
WinID = 'winder';
window.open(URL,WinID,'width='+Width+',height='+Height+',left='+Left+',top='+Top+',channelmode=0,dependent=0,directories=0,location=0,menubar=0,resizable='+Resizable+',scrollbars='+Scrollbars+',status=0,toolbar=0');
}

