elend = Math.min(selend,sv);
        }
    }

    for(let i=selstart;i<selend;++i)
    {
        let box = document.getElementById(`itm${currdbidxs[i]}`);
        if(box)
        {
            box.checked = isSel;
            selitm(currdbidxs[i]);
        }
    }
    countsel();
}

function invertsel()
{
    for(let i=0;i<currdbidxs.length;++i)
    {
        let box = document.getElementById(`itm${currdbidxs[i]}`);
        if(box)
        {
            box.checked = !box.checked;
  