function toggleInstructions() {
	// Used to "show" or "hide" the instructions to any particular page.  Used
	// in conjunction with the "instructionbox" id
	
	var tblEl = document.getElementById("instructionbox");
	var rowEl = tblEl.rows[1];
	if (rowEl.className == "hidden") 
		rowEl.className = "";
	else
		rowEl.className = "hidden";
	//	return false;
}

function toggleShowHide(myid,showMsg,hideMsg) {
	// Used to "show" or "hide" a div.  Used
	// in conjunction with the "shFilter" and "shInstr" id's
	//
	
	if (myid == "filter") {
		var id = "shFilter";
		var toggleId = "shTogFilter";
		}
	else if (myid == "ColSettings") {
		var id = "shColSets";
		var toggleId = "shTogColSets";
		}		
	else if (myid == "lcGamesToday") {
		var id = "lcGamesToday";
		var toggleId = "shTogGamesToday";
		}		
	else if (myid == "realNames") {
		var id = "shRealNames";
		var toggleId = "shTogRealNames";
		}		
	else {  // default to myid = 'instructions'
		var id = "shInstr";
		var toggleId = "shTogInstr";
		}
	
	var divEl = document.getElementById(id);
	var aEl = document.getElementById(toggleId);
	
	if (divEl.className == "hidden") {
		divEl.className = "";
		aEl.innerHTML = hideMsg;
		}
	else {
		divEl.className = "hidden";
		aEl.innerHTML = showMsg;
		}

	//	return false;
}

function showHideColumn(tableid,toggleid,colClass,showMsg,hideMsg) {
	// Used to "show" or "hide" a column in a table
	//
	// tableid:  id of the table
	// toggleid:  id of the anchor that acts as the toggle switch
	// colClass:  the class of the column (th and td's) that are to be hidden
	// showMsg:  the "show" link text for the toggle (e.g. "Show Real Names")
	// hideMsg:  the "hide" link text for the toggle (e.g. "Hide Real Names")
	
	
	var myToggle = document.getElementById(toggleid);

	var myTable = document.getElementById(tableid);
	var myHeaders = myTable.getElementsByTagName('TH');
	var myCells = myTable.getElementsByTagName('TD');
		
	for (i=1; i<myHeaders.length; i++)
	if (myHeaders[i].className == colClass + " hidden") {
		myHeaders[i].className = colClass;
		}
	else if (myHeaders[i].className == colClass){
		myHeaders[i].className = colClass + " hidden";
		
		}

	for (i=1; i<myCells.length; i++)
	if (myCells[i].className == colClass + " hidden") {
		myCells[i].className = colClass;
		}
	else if (myCells[i].className == colClass) {
		myCells[i].className = colClass + " hidden";
		}
	
	if (myToggle.innerHTML == hideMsg)
		myToggle.innerHTML = showMsg;
	else 
		myToggle.innerHTML = hideMsg;
		
	var standingsHeader = document.getElementById('standingsHeader');
	
	if (standingsHeader) {
		if (myToggle.innerHTML == hideMsg)
			standingsHeader.colSpan = standingsHeader.colSpan + 1;
		else 
			standingsHeader.colSpan = standingsHeader.colSpan - 1;
		}
	//	return false;
}

function help(helpid) 
{
	var r_window = window.open('help_window.cfm?helpid='+helpid,'Help','height=250,width=550,resizable,scrollbars');
	r_window.focus();
	return true;
}

function showHide(myid) {
	// Used to "show" or "hide" a div based on checking a box. 
		
	var divEl = document.getElementById(myid);
	
	if (divEl.className == "hidden") {
		divEl.className = "";
		}
	else {
		divEl.className = "hidden";
		}

	//	return false;
}

function textAreaLength(textbox,maxlength,countID) {
		var mylen = textbox.value.length;
		if (mylen > maxlength) {
			textbox.value = textbox.value.substring(0,maxlength);
			mylen = mbox.value.length;
		 }
		if (mylen > 0.9 * maxlength) {
		document.getElementById(countID).className = 'alert';
		document.getElementById(countID).innerHTML = mylen;
		} else {
		document.getElementById(countID).className = '';
		document.getElementById(countID).innerHTML = mylen;
		}
	}
	
	
	/* To use this function, you need to put "name='tab'" in the anchor tag
		and id the tabs and tab panes apropriately, like id="tab_1" etc. */
	function switchTab(iTab) {
		
		if (!window.myTabs) {
			// set the selected tab (hide the others)
			var myLinks=document.getElementsByTagName("A");
			j=0;
			myTabs = new Array;
			myTabPanes = new Array;
			for (i=0; i<myLinks.length; i++) {
			 	if (myLinks[i].name == "tab") {
					myTabs[j] = document.getElementById('tab_'+j);
					myTabPanes[j] = document.getElementById('tabPane_'+j);
					j++;
				}	
			}
		}
		
		for (i=0; i<myTabs.length; i++) { 
			if (i==iTab) { 
				myTabs[i].className = "tab selected";
				myTabPanes[i].className = "";
			}
			else {
				myTabs[i].className = "tab";
				myTabPanes[i].className = "hidden";
			}
		}
		
		return false;
	}
			
