/* toggle's an elements children with a particular class name to display/not display

	In order to use this, the children must have a default style="display: none;" or
		style="display: block;"
	
	The best use is to add this to the onclick event of an anchor, for example:
	
	<a href="?descriptions=on" onclick="return tD('listing', 'p', 'description')">toggle descriptions</a>
	
	This will follow the non-javascript link ONLY if the browser does not support javascript or the javascript
	code */

function tD(id, element, className) {
	// make it use the standard refresh
	if (!document.getElementById)
		return true;
	
	dds = document.getElementById(id).getElementsByTagName(element);
	for (i = 0; i < dds.length; i++) {
		if (dds[i].className.indexOf(className) != -1){
			dds[i].style.display = (dds[i].style.display == '' || dds[i].style.display=='block' ? 'none' : '');
		}
	}
	return false;
}


/* THESE ARE USED IN THE "TEST FOOTER" but can be used elsewhere */
function reveal(id) {
	document.getElementById(id).style.display= 'block';
	document.getElementById(id).style.visibility='visible';
}
function hide(id) {
	document.getElementById(id).style.display= 'none';

}
function setFocus(id) {
	try {
		document.getElementById(id).focus();
	} catch (e) {
		// no focus
	}
}
