<div id="groupsDownloads[1]" style="display:none">
<fieldset id="usersGroups[1]">
<legend>GR1</legend>
<table width"100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td><input type="checkbox" name="users_id[0]" value="3" onclick="usersIdCheckboxSelect('downloads', this)">&nbsp;B</td>
    <td><input type="checkbox" name="users_id[1]" value="41" onclick="usersIdCheckboxSelect('downloads', this)">&nbsp;Ck</td>
    <td><input type="checkbox" name="users_id[2]" value="38" onclick="usersIdCheckboxSelect('downloads', this)">&nbsp;D</td>
  </tr>
  <tr>
    <td><input type="checkbox" name="users_id[3]" value="22" onclick="usersIdCheckboxSelect('downloads', this)">&nbsp;A</td>
  </tr>
</table>
</fieldset>
<br />
<fieldset id="usersGroups[2]">
<legend>GR2</legend>
<table width"100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td><input type="checkbox" name="users_id[4]" value="22" onclick="usersIdCheckboxSelect('downloads', this)">&nbsp;A</td>
  </tr>
</table>
</fieldset>
</div>

function usersIdCheckboxSelect(formName, usersIdCheckbox)
{
        if(usersIdCheckbox.checked == true)
        {
                checkboxChecked = true;
        }
        else
        {
                checkboxChecked = false;
        }
        
        usersId                        = usersIdCheckbox.value;
        checkboxField        = document.getElementsByTagName("input");

    for(c=0;c<checkboxField.length;c++)
        {
        if(checkboxField[c].value == usersId)
                {
                        checkboxField[c].checked = checkboxChecked;
                }
        }        
}