/*	checks all none of the check boxes on the page
Created by 	[ADRIAN CORCORAN]
Website		[http://www.attikdesigns.ie]
*/

function getAllCheckedBoxesByFormIdAndSetTo(FormNameBase, FieldName, FormToSet, FieldToSet)
{
	//	initialise array
	var myArray	= new Array();
	//	loop through all forms on the page
	for (i=0; i<document.forms.length; i++)
	{
		//	if the basename matches the one supplied
		if (document.forms[i].id.substring(0, 18) == FormNameBase)
		{
			//	if the checkbox in this form is checked, add its' value (the users id) to the array
			if (document.forms[i].elements[FieldName].checked)
			{
				myArray.push(document.forms[i].elements[FieldName].value);
			}
		}
	}
	
/*	for (i=0; i<document.forms.length; i++)
	{
		if (document.forms[i].id.substring(0,17) == FormName)
		{
			document.forms[i].elements[FieldName].checked	= checkedOrNot;
		}
	}
/*
if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = checkOrNot;
*/
	document.getElementById(FormToSet).elements[FieldToSet].value	= myArray;
//	document.write(document.getElementById(FormToSet).elements[FieldToSet].value);
//	document.getElementById('jsPanel').innerHTML	= dump(myArray);
	return true;
}//-->

