+Lightbox.prototype.getCBIndex = function(cb) {
+ if (!this.cbIndex) {
+ // build checkbox index
+ this.cbIndex = [];
+ var i, node, c;
+ var nodes = this.grid.childNodes;
+ for (i=0 ; i<nodes.length ; i++) {
+ node = nodes[i];
+ if (node.nodeName === 'SPAN') {
+ c = node.getElementsByTagName('input')[0];
+ c.index = this.cbIndex.length;
+ this.cbIndex[this.cbIndex.length] = c;
+ }
+ }
+ }
+ return cb.index;
+};
+
+Lightbox.prototype.selectCBRange = function(evt) {
+ var target = getTargetedObject(evt);
+ evt = getEventObject(evt);
+ var shift = evt.shiftKey;
+ if (shift && this.lastCBChecked) {
+ var from = this.getCBIndex(this.lastCBChecked);
+ var to = this.getCBIndex(target);
+ var start = Math.min(from, to);
+ var stop = Math.max(from, to);
+ var i;
+ for (i=start ; i<stop ; i++ ) {
+ this.cbIndex[i].setAttribute('checked', 'checked');
+ }
+ }
+ else if (target.checked) {
+ this.lastCBChecked = target;
+ }
+ else {
+ this.lastCBChecked = undefined;
+ }
+};
+
+