+Lightbox.prototype.refreshGrid = function() {
+ var req = new XMLHttpRequest();
+ self = this;
+ req.onreadystatechange = function() {
+ switch (req.readyState) {
+ case 1 :
+ showProgressImage();
+ break;
+ case 4 :
+ hideProgressImage();
+ if (req.status === 200) {
+ self._refreshGrid(req);
+ }
+ break;
+ }
+ };
+
+ var url = absolute_url() +
+ '/portfolio_thumbnails_tail?start:int=0&size:int=' +
+ this.slides.length;
+ req.open('GET', url, true);
+ req.send();
+};
+
+Lightbox.prototype._refreshGrid = function(req) {
+ var doc = req.responseXML.documentElement;
+ var i, node;
+ var j = 0;
+ for (i=0 ; i<doc.childNodes.length ; i++) {
+ node = doc.childNodes[i];
+ if (node.nodeType === 1) {
+ node = getCopyOfNode(node);
+ this.grid.replaceChild(node, this.slides[j]);
+ this.slides[j] = node;
+ j++;
+ }
+ }
+ this.cbIndex = undefined;
+};
+
+Lightbox.prototype.fetchTail = function() {
+ var req = new XMLHttpRequest();
+ var self = this;
+ req.onreadystatechange = function() {
+ switch (req.readyState) {
+ case 1 :
+ showProgressImage();
+ break;
+ case 4 :
+ hideProgressImage();
+ if (req.status === 200) {
+ self._appendTail(req);
+ }
+ break;
+ }
+ };
+
+ var url = absolute_url() +
+ '/portfolio_thumbnails_tail?start:int=' +
+ String(this.slides.length) +
+ '&size:int=10';
+ req.open('GET', url, true);
+ req.send();
+};
+
+Lightbox.prototype._appendTail = function(req) {
+ var doc = req.responseXML.documentElement;
+ var i, node, c;
+ for (i=0 ; i<doc.childNodes.length ; i++) {
+ node = doc.childNodes[i];
+ if (node.nodeType === 1) {
+ this.lastSlide = this.grid.appendChild(getCopyOfNode(node));
+ this.slides.push(this.lastSlide);
+ if (this.cbIndex) {
+ c = this.lastSlide.getElementsByTagName('input')[0];
+ c.index = this.cbIndex.length;
+ this.cbIndex.push(c);
+
+ }
+ }
+ }
+ this.fetchingDisabled = false;
+ if (doc.getAttribute('nomore')) {
+ this.complete = true;
+ }
+ this.windowScrollGridHandler();
+};
+