//Sets all checkboxes in a joined set to on or off, depending on input

function toggleAll(elemName,boolVal) {

     var elem=document.getElementsByName(elemName);

     for (var i=0; i<elem.length; i++) {

          elem[i].checked=boolVal;

     }

     return true;

}

