/*
	toc.js
	Javascript functionality for table of contents checkboxes
		
	Provides three functions to check, uncheck, and invert the checked status
	of all checkboxes with the name specified by the 'f' ('field') argument.

	These functions are to be used as the onClick methods for three
	corresponding <input type="button"> buttons.
		
	Adapted from:
		http://javascript.internet.com/buttons/check-all.html
		http://www.somacon.com/blog/page17.php
*/

function checkall(f)
{
	if( !f.length )
	{ f.checked = true; }
	else
	{
		for( i=0; i<f.length; i++ )
		{ f[i].checked = true; }
	}
}

function uncheckall(f)
{
	if( !f.length )
	{ f.checked = false; }
	else
	{
		for( i=0; i<f.length; i++ )
		{ f[i].checked = false; }
	}
}

function togglecheck(f)
{
	if( !f.length )
	{ f.checked = !f.checked; }
	else
	{
		for( i=0; i<f.length; i++ )
		{ f[i].checked = !f[i].checked; }
	}
}
