/*

* ---------------------------------------------------------------------
* truc is a tool for requirement and use case tracking
* Copyright (C) 2006 ASDIS - http://sf.net/projects/truc
*
* (rth) Initial truc version based on rth
*       Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
*
* This program is distributed under the terms and conditions of the GPL
* See the README and LICENSE files for details
* ----------------------------------------------------------------------


* Check multiple checkboxes on page
* INPUT:
*   Checkbox_Clicked by user
* OUTPUT:
*   Checks checkboxes on page if:
*		checkbox name starts with "row_" and checkbox value == value of clicked checkbox
*		OR
*		checkbox name starts with "row_" and Checkbox_Clicked name == "checkall"
*		
*/
function checkValue( theBox ) {

	form = theBox.form;

	for(i=0; i<form.length; i++) {
		
		elementName  = form.elements[i].name.split("_", 2);
		elementValue = form.elements[i].value;
		
		if( elementName[0]=="row" && elementValue==theBox.value ) {
			
			// Set the element "checked" value = theBox "checked" value
			form.elements[i].checked = theBox.checked;
		}
	}
}

function checkAll( theBox ) {

	form = theBox.form;

	for(i=0; i<form.length; i++) {
		
		elementName  = form.elements[i].name.split("_", 2);
		elementValue = form.elements[i].value;
		
		if( elementName[0]=="row" ) {
			
			// Set the element "checked" value = theBox "checked" value
			form.elements[i].checked = theBox.checked;
		}
	}
}