/*
	Toggle the visibility of a named element.
	This will largely replace the toggleToc() function below.
*/
function toggleEntry(name) {
				 var toc = document.getElementById(name);
				 var showlink=document.getElementById(name + '_show');
				 var hidelink=document.getElementById(name + '_hide');

				 if(toc.style.display == 'none') {
				 	  	toc.style.display = tocWas;
						  hidelink.style.display='';
							showlink.style.display='none';
				 } else {
				 	 		tocWas = toc.style.display;
							toc.style.display = 'none';
							hidelink.style.display='none';
							showlink.style.display='';
				 }
}

/*
	Toggle visibility of a specific element containing a table of contents.
	Because it operates on an explicit ID name, it isn't useful for
	expanding and collapsing different branches of a tree.
	Its logic is being adapted and enhanced in the toggleEntry()
	function above.
*/
function toggleToc() {
	var toc = document.getElementById('tocinside');
	var showlink=document.getElementById('showlink');
	var hidelink=document.getElementById('hidelink');

	if(toc.style.display == 'none') {
		toc.style.display = tocWas;
		hidelink.style.display='';
		showlink.style.display='none';

	} else {
		tocWas = toc.style.display;
		toc.style.display = 'none';
		hidelink.style.display='none';
		showlink.style.display='';

	}
}

/*
	Write out "Show" and "Hide" links that will switch places when clicked.
*/
function showTocToggle(show,hide) {
	if(document.getElementById) {
		document.writeln('<span class=\'toctoggle\'>[<a href="javascript:toggleToc()" class="internal">' +
		'<span id="showlink" style="display:none;">' + show + '</span>' +
		'<span id="hidelink">' + hide + '</span>'
		+ '</a>]</span>');
	}
}
function toggleVisibility( _levelId, _otherId, _linkId) {
	var thisLevel = document.getElementById( _levelId );
	var otherLevel = document.getElementById( _otherId );
	var linkLevel = document.getElementById( _linkId );
	if ( thisLevel.style.display == 'none' ) {
		thisLevel.style.display = 'block';
		otherLevel.style.display = 'none';
		linkLevel.style.display = 'inline';
	} else {
		thisLevel.style.display = 'none';
		otherLevel.style.display = 'inline';
		linkLevel.style.display = 'none';
		}
}

