  function moveDualList(srcList, destList, moveAll) {
    var i=0;
    while(i<srcList.options.length) {
      if ((moveAll) || (srcList.options[i].selected)) {
        var newOpt = new Option(srcList.options[i].text, srcList.options[i].value);
        newOpt.selected = true;
        destList.options.add(newOpt);

        srcList.options[i] = null;
      } else {
        i++;
      }
    } // end while
  }

  function addSelected(addAll) {
    moveDualList(document.getElementById('addressbooklist'), document.getElementById('granteduserslist'), addAll);
  }

  function addAll() {
    addSelected(true);
  }

  function removeSelected(addAll) {
    moveDualList(document.accesslistform.granteduserslist, document.accesslistform.addressbooklist, addAll);
  }

  function removeAll() {
    removeSelected(true);
  }

  function accesslistform_onsubmit() {
    for(var i=0; i<document.accesslistform.addressbooklist.options.length; i++) {
      document.accesslistform.addressbooklist.options[i].selected = true;
    }
    
    for(var i=0; i<document.accesslistform.granteduserslist.options.length; i++) {
      document.accesslistform.granteduserslist.options[i].selected = true;
    }
  }

