// call this function to keep track of the state of any element
// for this function to work, you must have show and hide.
function whatState(str) {
if (flagState==0) // if the element is off?
	{
		show(str); // show it! (pass the show function)
	}
else if (flagState==1) // if the element is on?
	{
		hide(str); // hide it! (pass the hide function)
	}
}

function hide(str) {
x = document.getElementById(str);
x.style.display = 'none'; // hide the element
flagState = 0; // now it's off, keeping track of its state
}
function show(str) {
x = document.getElementById(str);
x.style.display = 'block'; // show the element
flagState = 1; // now it's on, keeping track of its state
}