var theURL = window.location.search;
var thePosition = theURL.indexOf("=") + 1;
// var theCat = theURL.substring(thePosition, theURL.length); //

function hide_all() {
	var myDiv = document.getElementById('openingDiv');
    myDiv.style.display = "none";
	
    var myDiv = document.getElementById('programDiv');
    myDiv.style.display = "none";
    
	var myDiv = document.getElementById('abstractsDiv');
    myDiv.style.display = "none";
	
 	var myDiv = document.getElementById('sponsorsDiv');
    myDiv.style.display = "none";	

 	var myDiv = document.getElementById('imagesDiv');
    myDiv.style.display = "none";
	
	var myDiv = document.getElementById('contactDiv');
    myDiv.style.display = "none";
}

function show_hide(theDiv){
	 hide_all();
     var myDiv = document.getElementById(theDiv);
	 myDiv.style.display = "block";
}

	function validate() {
		var allok = false;
		var thisform = document.ListForm;
		if(!thisform.pickName.length){
			if(thisform.pickName.checked == false) {
				window.alert('You must select at least one record.');
				return false;
				//allok = true
			}else{
				allok = true;
				//return true;
				//document.ListForm.submit();
			}
			
		} else {
			for(var i=0; i < thisform.pickName.length; i++) {
				if (thisform.pickName[i].checked == true) {
					allok = true;	
					//return true;
					break;
					//document.ListForm.submit();
				}
		}
		
			if(allok){
				document.ListForm.submit();
			}else{
				alert("You must select at least one record");
				return false;
			}
			//window.alert('You must select at least one record.');
			//return false;
		}
	}

    function selectAll(form) {
        if(form.pickName.length){
		    for(var i=0; i < form.pickName.length; i++) {
                form.pickName[i].checked = true;
                }
                return true;

        } else {
            form.pickName.checked = true;
        }
     }

//* 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'
 
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('fullSearchDiv');
break;

}
}

