             elements[i].style.visibility = visibility;
            }
        }

        if (typeof setPresentationSelection !== 'undefined') {
            var selection = [];

            function addSelection(target, layer, keepSelection) {
                let index = -1;

                for (let i = 0; i < selection.length; i++) {
                    if (selection[i].target === target && selection[i].layer === layer) {
                        index = i;
                        break;
                   