
function setElementVisibility(id, visible) {
	var element = document.getElementById(id);
	if (element != null) {
		if (visible)
			element.style.display = '';
		else
			element.style.display = 'none';
	} else {
		alert("Script error: no element found with ID " + id);
	}
}


// These functions show/hide a tooltip. Tooltips are implemented using
// Dyn-web.com's DHTML tooltip, the code for which can be found in dw_*.js.
// These files are included AT THE END of the TexAgs page template in
// /libraries/template.asp, since that's where they told me to link it, and it
// doesn't seem to work if I include them earlier in the page.
function showTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.show(e, msg);
}
function hideTooltip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}

function nextPanel()
{
	showPanel(currentPanelIndex + 1, false);
}

function showPanel(panelIndex, isManual)
{
	if (isManual) clearInterval(panelTimer);

	var oPanelOld = document.getElementById("panel" + currentPanelIndex);
	if (oPanelOld != null) oPanelOld.style.display = "none";

	currentPanelIndex = panelIndex;

	var oPanelNew = document.getElementById("panel" + currentPanelIndex);

	if (oPanelNew == null)
	{
		currentPanelIndex = 1;
		oPanelNew = document.getElementById("panel" + currentPanelIndex);
	}

	if (!isManual && oPanelNew.tabIndex != "100")
	{
		nextPanel()
	}
	else
	{
		oPanelNew.style.display = "block";
	}
}

function startPanels()
{
	nextPanel();
	panelTimer = window.setInterval(nextPanel, 3000);
}

