/*
Content contians the basic javascript functions to hide and unhide content and
highlight menu options.  It requires a hiden field on the HTML page to hold which
menu item is currently being displayed.  This hidden field is called 'booleanVar'.
Though it is not a boolean variable anymore.

by: Oran Weaver 12/24/2005


//class='text' is the CSS class that controls the div tag (optional)
//id = the id of the header tag (this is used for mouseover, mouseout and onclick
//on a mouse over, it uses the change() function to change the look of the title,
   on a mouse out, it uses the chnageBack() function to revert back to normal.
   on a mouse click, we want to hide the orignal exposed content and open the content for
		the title clicked on (this is done with the function hide().  We then want to change 
		the item back since the mouse really don't leave it, and then we want to scroll to
		either the current title or the top title (the top title is less confusing, a user can
		that their orignal titles did not dissapear)
//also note that the first item is not hidden (set: style="DISPLAY: Block") and all others 
	are (set: style="DISPLAY: none")
	
a sample of how this is used (place this in the html code):		

<div class="text" id="linkedDatabases" onmouseover="change('thisTitle')"
 onclick="hide('thisTitleContent');changeBack('thisTitle'); scrollToMe('topTitle');"
	onmouseout="changeBack('thisTitle')">
<p style="FONT-SIZE: medium; CURSOR: hand; FONT-FAMILY: Arial" align="left">Title text here</p>
</div>
<div class="content" id="thisTitleContent" style="DISPLAY: none">content text here</div>
*/
function hide(itemID)
{
	hideThis = document.getElementById("booleanVar").getAttribute("value");
	document.getElementById(hideThis).style.display = "none";
	document.getElementById(itemID).style.display = "block";
	document.getElementById("booleanVar").setAttribute("value",itemID);
}
function scrollToMe(headerID)
{
	document.getElementById(headerID).scrollIntoView();
}
function change(itemID)
{
	document.getElementById(itemID).style.color = "#505050";
	document.getElementById(itemID).style.background = "#ffff99";
}
function changeBack(itemID)
{
	document.getElementById(itemID).style.color = "#5050ff";
	document.getElementById(itemID).style.background = "#ffffff";
}
/*checkLink is used to open a specific section on a loading page.  This is best
described as cross page indexing
usage:
  (from calling page) <a href="../home.aspx?nutritionAndPalatabilityContent>link to
			 nutrition and palatability</a>
			 
  (receiviving page in the BODY tag) <BODY MS_POSITIONING="GridLayout" onload="checkLink()"> 	 

*/
function checkLink()
{
	if (location.search.length < 2) //make sure we are not looking at an empty string
		return; //return if we are
	var query = location.search.substring(1); //remove the '?' from the string
	var pairs = query.split(","); //split all setctions of the string
	if (pairs.length < 1) //if there is nothing after the '?' return, empty set
		return;
	else
		hide(pairs[0].substring(0)); //display the area requested
}