
var innerHTMLMap = new Array();
	innerHTMLMap['aboutus'] = '<div class="subNavLink"><a href="overview.php">overview</a></div><div class="subNavLink"><a href="managementteam.php">management team</a></div><div class="subNavLink"><a href="sab.php">science advisory board</a></div><div class="subNavLink"><a href="pressreleases.php">press releases</a></div><div class="subNavLink"><a href="careers.php">careers</a></div>';
	innerHTMLMap['apps'] = '<div class="subNavLink"><a href="solarenergy.php">solar energy</a></div><div class="subNavLink"><a href="displays.php">displays</a></div><div class="subNavLink"><a href="vision.php">vision</a></div><div class="subNavLink"><a href="chembio.php">chemical and biological sensing</a></div>';
	
var paddingMap = new Array();
	paddingMap['aboutus'] = '115px';
	paddingMap['apps'] = '20px';
	
var pages = new Array('home', 'aboutus', 'coretech', 'apps', 'contactus');

function navOver(page) {
	var myRef;
	
	// Reset all classes to navLink.
	for (var p in pages) {
		myRef = getRefToDiv(pages[p]);
		myRef.className = 'navLink';
	}
	
	// Highlight the active nav link by chaning class to navLinkActive
	myRef = getRefToDiv(page);
	myRef.className = 'navLinkActive';
	
	if(!innerHTMLMap[page]) {
		hideDiv('subnav');
		return;
	}
	
	// Change the HTML of the subnav DIV, adjust its margin, and display.
	changeInnerHTML('subnav', innerHTMLMap[page]);
	myRef = getRefToDiv('subnav');
	if(myRef.style) {
		myRef.style.paddingRight = paddingMap[page];
	}
	
	showDiv('subnav');
}

function getRefToDiv(divID,oDoc) {
    if( !oDoc ) { oDoc = document; }
    if( document.layers ) {
        if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getRefToDiv(divID,oDoc.layers[x].document); }
            return y; } }
    if( document.getElementById ) {
        return document.getElementById(divID); }
    if( document.all ) {
        return document.all[divID]; }
    return false;
}

function showDiv(divID_as_a_string) {
    //get a reference as above ...
    myReference = getRefToDiv(divID_as_a_string);
	
    if( !myReference ) {
        window.alert('Nothing works in this browser');
        return false; //don't go any further
        //return anything would work,
        //but I am using false to show failure
    }
    //now we have a reference to it
    if( myReference.style ) { //DOM & proprietary DOM
        myReference.style.visibility = 'visible';
    } else {
        if( myReference.visibility ) { //Netscape
            myReference.visibility = 'show';
        } else {
            window.alert('Nothing works in this browser');
            return false; //don't go any further
        }
    }
    return true;
}

function hideDiv(divID_as_a_string) {
    //get a reference as above ...
    myReference = getRefToDiv(divID_as_a_string);
	
    if( !myReference ) {
        window.alert('Nothing works in this browser');
        return false; //don't go any further
        //return anything would work,
        //but I am using false to show failure
    }
    //now we have a reference to it
    if( myReference.style ) { //DOM & proprietary DOM
        myReference.style.visibility = 'hidden';
    } else {
        if( myReference.visibility ) { //Netscape
            myReference.visibility = 'hide';
        } else {
            window.alert('Nothing works in this browser');
            return false; //don't go any further
        }
    }
    return true;
}

function changeInnerHTML(divID_as_a_string,newtext) {
	myReference = getRefToDiv(divID_as_a_string);
	
	if( typeof( myReference.innerHTML ) != 'undefined' ) {
	  //used by the IE series, Konqueror, Opera 7+ and Gecko browsers
	  myReference.innerHTML = newtext;
	} else {
	  if( myReference.document && myReference.document != window.document ) {
	    //used by layers browsers
	    myReference.document.open();
	    myReference.document.write(newtext);
	    myReference.document.close();
	  } else {
	    if( window.frames && window.frames.length && window.frames['nameOfIframe'] ) {
	      //used by browsers like Opera 6-
	      //if we attempt to rewrite the iframe content before
	      //it has loaded we will only produce errors
	      myReference = window.frames['nameOfIframe'].window;
	      myReference.document.open();
	      myReference.document.write(newtext);
	      myReference.document.close();
    	}
	  }
	}
}

function viewpr(pr) {
	window.open('/pressreleases/' + pr,'','location=no,menubar=yes,scrollbars=yes,toolbar=no,resizable=yes,height=450,width=500');
}

