/*	Visibility Switching Library
 *	Copyright (c) 2004 Traction Corporation
 *	All Rights Reserved
 *	http://www.tractionco.com
 */

/*
 *	NOTE:	Javascript doesn't know what a css box's visible state is until it sets it itself.
 *			So just because you say visible or hidden in your css means nothing as far as testing the state.
 *			One handy workaround if you're going to be depending on testing the states is to run a script onLoad() that sets the desired initial states.
 */

// Instead of having to call toggleVisibility() a bunch of times in a row,
// you can send toggleVisMulti() a bunch of css id's at the same time.
// You can send as many or as few as you'd like.
function toggleVisMulti(){
	if(arguments.length > 0){
		for(i=0;i<arguments.length;i++){
			var theID = arguments[i];
			toggleVisibility(theID);
		}
	}
}

// tests current visibility state for a given id, then switches it.
function toggleVisibility(theID){
	if(document.getElementById(theID).style.visibility != "visible"){
		setVisibility(theID,"visible");
	}else{
		setVisibility(theID,"hidden");
	}
}

// does the actual setting of visible states
function setVisibility(theID,visibleState){
	document.getElementById(theID).style.visibility = visibleState;
}

// much like toggleVisMulti(), only it hides them all instead of toggle
function hideEm(){
	if(arguments.length > 0){
		for(i=0;i<arguments.length;i++){
			var theID = arguments[i];
			setVisibility(theID,"hidden");
		}
	}
}

// much like toggleVisMulti(), only it shows them all instead of toggle
function showEm(){
	if(arguments.length > 0){
		for(i=0;i<arguments.length;i++){
			var theID = arguments[i];
			setVisibility(theID,"visible");
		}
	}
}