/* ing.js */

function hide_all() {
	var myDiv = document.getElementById('searchDiv');
    myDiv.style.display = "none";
	
    var myDiv = document.getElementById('introDiv');
    myDiv.style.display = "none";
    
    var myDiv = document.getElementById('helpDiv');
    myDiv.style.display = "none";
	
	var myDiv = document.getElementById('citationDiv');
    myDiv.style.display = "none";

    var myDiv = document.getElementById('contactDiv');
    myDiv.style.display = "none";

    var myDiv = document.getElementById('collaboratorsDiv');
    myDiv.style.display = "none";
	
    var myDiv = document.getElementById('returnLinkDiv');
    myDiv.style.display = "none";
}

function show_hide(theDiv){
	 hide_all();
     var myDiv = document.getElementById(theDiv);
	 myDiv.style.display = "block";
//* This section is included if you want to hide and expose the menu item to return to the opening page.
     var myReturn = document.getElementById('returnLinkDiv');
	 if (theDiv != "searchDiv") {
	 	myReturn.style.display = "block";
	 }

}


//* This function shows the div for the term passed on the URL. 
//* It checks for collections, research, publications, images, references, partners, contacts and events.
//* The terms are case sensitive--use all lowercase letters.
//* Other sections open in windows or show directly on the page.
//* The syntax is 'http://www.nmnh.si.edu/botany/index.html?research'
//* Note that the 'onload' function from NKM must run the checkURL as well.
//* UNDER framebust(); ADD checkURL(); AND BE SURE THIS STAYS IN PLACE IF THE TEMPLATE IS UPDATED.

var theURL = window.location.search;
var thePosition = theURL.indexOf("=") + 1;
// var theCat = theURL.substring(thePosition, theURL.length); //
 
function checkURL() {
var whichSection = "";
if (location.search) {
var whichSection = location.search.substring(1);
}	
	
switch (whichSection)
{
case "search":
show_hide('searchDiv');
break;

case "intro":
show_hide('introDiv');
break;

case "help":
show_hide('helpDiv');
break;

case "contact":
show_hide('contactDiv');
break;

case "citation":
show_hide('citationDiv');
break;

}
}

