function _cbChanged() {
  const elHdrNew = document.getElementsByClassName("checkitems-header__E__new")[0];
  const elHdrDel = document.getElementsByClassName("checkitems-header__E__del")[0];
  const aelCB=document.getElementsByClassName("row__cb");
  var fChecked=false;

  for(elCB of aelCB)
    if (elCB.checked==true &amp;&amp; elCB.name=="del") { fChecked=true; break; }

  if (fChecked) {
    elHdrNew.classList.add("checkitems-header__E__new--hidden");
    elHdrDel.classList.remove("checkitems-header__E__del--hidden");
    document.getElementById("check-item-list__new-cb").checked=false;
  }
  else {
    elHdrNew.classList.remove("checkitems-header__E__new--hidden");
    elHdrDel.classList.add("checkitems-header__E__del--hidden");
  }
}

window.addEventListener("load", function() {
  const aelCB=document.getElementsByClassName("row__cb");
  const elNewCB=document.getElementById("check-item-list__new-cb");

  for(elCB of aelCB)
    elCB.onclick=_cbChanged;

  document.getElementById("select-all").onclick=function() {
    for(elCB of aelCB)
      if(!elCB.disabled) elCB.checked=this.checked;
    _cbChanged();
  }

  if (elNewCB)
    elNewCB.addEventListener("click", function() {
      const elForm=document.getElementById("check-item-list__form-new");
      if (elForm) {
        const elInput=elForm.getElementsByTagName("input")[0];
        if (elInput) elInput.focus();
      }
    } );

/*
  document.getElementById("check-item-list").addEventListener("submit", function(e) {
    e.preventDefault();
  }, false );
*/

  _cbChanged();
});
