/* List Builder Support */

function acs_ListFindInput() {
  if (document.getElementsByTagName) {
    return document.getElementsByTagName('input');
  } else if (document.all) {
    return document.all.tags('input');
  }
  return false;
}

function acs_ListCheckAll(listName, checkP) {
  var Obj, Type, Name, Id;
  var Controls = acs_ListFindInput(); if (!Controls) { return; }
  // Regexp to find name of controls
  var re = new RegExp('^' + listName + ',.+');

  checkP = checkP ? true : false;

  for (var i = 0; i < Controls.length; i++) {
    Obj = Controls[i];
    Type = Obj.type ? Obj.type : false;
    Name = Obj.name ? Obj.name : false;
    Id = Obj.id ? Obj.id : false;

    if (!Type || !Name || !Id) { continue; }

    if (Type == "checkbox" && re.exec(Id)) {
      Obj.checked = checkP;
    }
  }
}

