/*declares 'global' variable: 
it is essential to declare the value of this variable in the body onload event to set the initial state as off*/
/* to call flag-tracking function in html anchor link: onclick="whatState('whateverString');" */
var flagState; 

function hide(str) {
x = document.getElementById(str);
x.style.visibility = 'hidden'; //hides the document element
flagState = 0; // indicates that the doc element is now off to keep track of the document element state
}
function show(str) {
x = document.getElementById(str);
x.style.visibility = 'visible'; //shows the doc element
flagState = 1; // indicates that the doc element is now on to keep track of the document element state
}

/* call this function to keep tract of the on/off state of any doc element */
/* this function requires that show and hide exist to work */
function whatState(str) {
if (flagState==0) //if the doc element is off (indicated by flagstate=0) then 
	{
		show(str); // pass the string to the show function
	}
else if (flagState==1) //if the doc element is already on (indicated by flagstate=1) then
	{
		hide(str); //pass the string to the hide function
	}
}

//create the array of tab class names, one per tab navthird-1, navthird-2, ...etc
var totalTabs=4; // total number of tabs on any of the pages using the script
var tabs = new Array(); 
for (j=0; j<totalTabs; j++){
	tabs[j] = "navthird-"+(j+1); //j+1 because the tabs start at 1 while arrays start at 0
}

function tabOn(id) {
	for (i=0; i<tabs.length; i++) { //go thru all the tabs in the array
		if ((tabs[i]!=id)||(id=='')) {	 //if the tab in the array is not the tab that should be on
			changeClass(tabs[i],'off'+tabs[i]); //turn the non-selected tab to it's off class
		}
		if (id!='') { //if a specific tab should be on (when nothing is passed into the function, all tabs are turned off)
			changeClass(id,'on'+id); //turn the tab to the on class
		}
	}
}

function changeClass(id, newClass){
if ((document.getElementById(id)!=null)&&(document.getElementById(id)!='')){ //check to make sure there's an object
	identity=document.getElementById(id); //find the element by it's id
	identity.className=newClass; //give that specific element a new class
}
}

// For the text links with drop-down menus
function boxDrop(id) {
if (flagState==0) // Clicking the link for the first time
	{
		changeClass(id, id+'On'); // Give the link the "on" state look.
	}
else if (flagState==1) // Clicking the link for the second time
	{
		changeClass(id, id+'Off'); // Now give the link the "off" state look.
	}
}

function changeText(strId)
{
var originalText = document.getElementById(strId).innerHTML;

if (flagState==0){
	document.getElementById(strId).innerHTML="[&#151;]"
	}
else if (flagState==1){
	document.getElementById(strId).innerHTML="[+]"
	}
}