(typeof start !== 'number' || node.style.display || node.style.visibility) {
start = obj[property];
}
arr[idx].push({ node: node, property: property, start: start, finish: obj[property] });
if (obj.id === 'fbMainDiv') {
arr[idx].push({ node: this.fbContent, property: property, start: start, finish: obj[property] });
}
if (obj.id === 'fbZoomDiv' && /\b(width|height)\b/i.test(property)) {
arr[idx].push({ node: this.fbZoomImg, property: property, start: start, finish: obj[property] });
}
this.pos[obj.id][property] = obj[property];
}
}
} else if (typeof arguments[i] === 'function') {
oncomplete = arguments[i];
}
}
this.resizeGroup(arr[0], function() { that.resizeGroup(arr[1], oncomplete); });
},
showContent: function(phase) {
var that = this;
if (!phase) {
var displaySize = this.getDisplaySize();
if (!this.resized) {
var vscrollChanged = displaySize.width !== this.displaySize.width,
hscrollChanged = displaySize.height !== this.displaySize.height;
if ((vscrollChanged && Math.abs(this.pos.fbBox.width - displaySize.width) < 50) ||
(hscrollChanged && Math.abs(this.pos.fbBox.height - displaySize.height) < 50)) {
this.resized = true;
return this.calcSize(this.scaledBy);
}
}
this.resized = false;
self.focus();
if (this.ieOld) this.stretchOverlay()();
if ((this.disableScroll || (this.ffOld && /iframe|quicktime/i.test(this.currentItem.type))) && !(this.ieOld || this.webkitOld || this.ie8b2)) {
if (this.pos.fbBox.width <= displaySize.width && this.pos.fbBox.height <= displaySize.height) {
this.setPosition(this.fbBox, 'fixed');
}
}
if (this.currentItem.type === 'iframe') {
this.fbContent.src = this.currentItem.href;
} else if (/flash|quicktime/.test(this.currentItem.type)) {
this.setInnerHTML(this.fbContent, this.objectHTML(this.currentItem.href,
this.currentItem.type, this.pos.fbMainDiv.width, this.pos.fbMainDiv.height));
}
this.prevIndex = this.currentIndex ? this.currentIndex - 1 : this.itemCount - 1;
this.nextIndex = this.currentIndex < this.itemCount - 1 ? this.currentIndex + 1 : 0;
var prevHref = this.enableWrap || this.currentIndex !== 0 ? this.items[this.prevIndex].href : '',
nextHref = this.enableWrap || this.currentIndex !== this.itemCount - 1 ? this.items[this.nextIndex].href : '';
if (this.navButton) {
if (prevHref) {
if (!this.operaOld) this.fbPrev.href = prevHref;
this.fbPrev.title = this.fbOverlayPrev.title;
} else {
this.fbPrev.removeAttribute('href');
this.fbPrev.title = '';
}
if (nextHref) {
if (!this.operaOld) this.fbNext.href = nextHref;
this.fbNext.title = this.fbOverlayNext.title;
} else {
this.fbNext.removeAttribute('href');
this.fbNext.title = '';
}
var prevOn = this.fbPrev.className.replace('_off', ''),
nextOn = this.fbNext.className.replace('_off', '');
this.fbPrev.className = prevOn + (prevHref ? '' : '_off');
this.fbNext.className = nextOn + (nextHref ? '' : '_off');
}
if (this.navOverlay) {
if (!this.operaOld) {
this.fbLeftNav.href = this.fbOverlayPrev.href = prevHref;
this.fbRightNav.href = this.fbOverlayNext.href = nextHref;
}
this.fbLeftNav.style.visibility = prevHref ? '' : 'hidden';
this.fbRightNav.style.visibility = nextHref ? '' : 'hidden';
fb.navOverlayShown = true;
}
this.fbCanvas.style.visibility = '';
return this.restore(function() {
that.timeouts.showContent = setTimeout(function() { that.showContent(1); }, 10);
} );
}
this.lastShown = this.currentItem;
if (!this.currentItem.seen) {
this.currentItem.seen = true;
this.itemsShown++;
}
if (this.isSlideshow && !this.isPaused) {
this.timeouts.slideshow = setTimeout(function() {
if (that.endTask === 'loop' || that.itemsShown < that.itemCount) {
that.newContent(that.nextIndex);
} else if (that.endTask === 'exit') {
that.end();
} else {
that.setPause(true);
var i = that.itemCount;
while (i--) that.items[i].seen = false;
that.itemsShown = 0;
}
}, this.slideInterval*1000);
}
this.timeouts.preload = setTimeout(function() {
that.preloadImages(nextHref || prevHref || '', true);
}, 10);
},
objectHTML: function(href, type, width, height) {
if (type === 'flash') {
var classid = 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"',
mime = 'type="application/x-shockwave-flash"',
pluginurl = 'http://get.adobe.com/flashplayer/',
match = /\bwmode=(\w+?)\b/i.exec(href),
wmode = match ? match[1] : 'window',
match = /\bbgcolor=(#\w+?)\b/i.exec(href),
bgcolor = match ? match[1] : '',
match = /\bscale=(\w+?)\b/i.exec(href),
scale = match ? match[1] : 'exactfit',
params = { wmode:wmode, bgcolor:bgcolor, scale:scale, quality:'high',
flashvars:'autoplay=1&ap=true&border=0&rel=0' };
if (this.ffOld) params.wmode = this.ffMac ? 'window' : 'opaque';
if (this.ffNew && href.indexOf('YV_YEP.swf') !== -1) params.wmode = 'window';
} else {
var classid = 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"',
mime = 'type="video/quicktime"',
pluginurl = 'http://www.apple.com/quicktime/download/',
params = { autoplay:'true', controller:'true', showlogo:'false', scale:'tofit' };
}
var html = '';
} else {
html += '
' +
(type === 'flash' ? 'Flash' : 'QuickTime') + ' player is required to view this content.' +
'
download player
';
}
return html;
},
newContent: function(index) {
var that = this;
this.clearTimeout('slideshow');
this.clearTimeout('resize');
this.currentIndex = index;
fb.previousAnchor = this.currentItem;
this.currentItem = this.items[index];
if (this.showNavOverlay == 'once' && this.navOverlayShown) this.showNavOverlay = false;
var oncomplete = function() {
that.updatePanels();
that.fetchContent(function() { that.calcSize(); });
};
this.collapse(function() {
that.timeouts.fetch = setTimeout(oncomplete, 10);
} );
},
end: function(all) {
if (this !== fb.lastChild) return fb.lastChild.end(all);
var that = this;
this.endAll = this.endAll || all;
this.fbOverlay.onclick = null;
if (this.isChild) {
if (this.endAll) this.imageFadeDuration = this.overlayFadeDuration = this.resizeDuration = 0;
} else {
if (document.keydownSet) {
document.onkeydown = this.priorOnkeydown;
document.keydownSet = false;
}
if (document.keypressSet) {
document.onkeypress = this.priorOnkeypress;
document.keypressSet = false;
}
parent.focus();
}
if (this.ieOld) {
detachEvent('onresize', this.stretchOverlay());
detachEvent('onscroll', this.stretchOverlay());
}
for (var key in this.timeouts) {
if (this.timeouts.hasOwnProperty(key)) this.clearTimeout(key);
}
if (this.fbBox.style.visibility) {
if (!this.lastShown) this.fbZoomDiv.style.display = 'none';
} else if (this.currentItem.type === 'img' && this.zoomImageStart) {
if (this.currentItem.popup) this.currentItem.anchor.onmouseover();
var anchorPos = this.getAnchorPos(this.currentItem.anchor, true);
if (this.currentItem.popup) this.currentItem.anchor.onmouseout();
if (anchorPos.width) {
this.fbZoomDiv.style.borderWidth = this.zoomPopBorder + 'px';
anchorPos.left -= this.zoomPopBorder;
anchorPos.top -= this.zoomPopBorder;
this.pos.thumb = anchorPos;
return this.zoomOut();
}
}
if (!this.fbBox.style.visibility) {
var anchorPos = this.getAnchorPos(this.currentItem.anchor, !this.currentItem.popup),
offset = this.initialSize/2,
initialPos = { id: 'fbBox', left: anchorPos.left - offset, top: anchorPos.top - offset, width: this.initialSize, height: this.initialSize },
zeroPos = { id: 'fbBox', left: anchorPos.left, top: anchorPos.top, width: 0, height: 0, borderWidth: 0 },
split = this.splitResize;
if (split === 'wh') {
split = 'hw';
} else if (split === 'hw') {
split = 'wh';
} else if (split === 'auto') {
split = this.pos.fbBox.width <= this.pos.fbBox.height ? 'hw' : 'wh';
}
var oncomplete3 = function() {
setTimeout(function() {
that.fbBox.style.visibility = 'hidden';
that.end();
}, 10);
};
if (split) {
var oncomplete2 = function() {
that.setSize(split, initialPos, function() {
that.setSize(zeroPos, oncomplete3);
});
};
} else {
var oncomplete2 = function() {
that.setSize(zeroPos, oncomplete3);
};
}
var oncomplete = function() {
setTimeout( function() {
if (that.fbContent) {
that.fbMainDiv.removeChild(that.fbContent);
delete that.fbContent;
}
}, 20);
that.fbLoader.style.display = '';
that.fbCanvas.style.display = that.fbShadowTop.style.display = that.fbShadowRight.style.display =
that.fbShadowBottom.style.display = that.fbShadowLeft.style.display = that.fbShadowCorner.style.display = 'none';
oncomplete2();
};
return this.collapse(oncomplete);
}
this.fbBox.style.display = 'none';
var level = this.children.length + 1,
i = this.anchors.length;
while(i && this.anchors[i-1].level >= level) i--;
this.anchors.length = i;
if (this.isChild) this.children.length--;
fb.lastChild = this.children[this.children.length-1] || fb;
var oncomplete2 = function() {
setTimeout(function() {
while (that.nodeNames.length) {
var id = that.nodeNames.pop();
if (that[id] && that[id].parentNode) {
that[id].parentNode.removeChild(that[id]);
delete that[id];
}
}
if (that.endAll && that.isChild) {
return fb.end(true);
} else if (that.loadPageOnClose) {
if (that.loadPageOnClose === 'self' || that.loadPageOnClose === 'this') {
location.reload(true);
} else if (that.loadPageOnClose === 'back') {
history.back();
} else {
location.replace(that.loadPageOnClose);
}
}
}, 10);
};
var oncomplete = function() {
while(that.hiddenEls.length) {
var el = that.hiddenEls.pop();
el.style.visibility = 'visible';
if (this.ffOld && this.ffMac) {
el.focus();
el.blur();
}
}
var overlay = that.fbOverlay.style;
overlay.display = 'none';
overlay.width = overlay.height = '0';
var duration = that.currentItem.popup ? 6.5 : 0;
that.fbZoomDiv.style.opacity = '1';
that.fadeOpacity( that.fbZoomDiv, 0, duration, oncomplete2);
that.currentItem = fb.previousAnchor = null;
};
this.fadeOpacity(this.fbOverlay, 0, this.overlayFadeDuration, oncomplete);
},
zoomIn: function(phase) {
var that = this,
zoomDiv = this.fbZoomDiv.style;
if (!phase) {
this.clearTimeout('slowLoad');
zoomDiv.display = this.fbZoomImg.style.display = '';
if (this.currentItem.popup) this.currentItem.anchor.onmouseout();
var pad = this.outerBorder + this.innerBorder - this.zoomPopBorder;
var oncomplete = function () {
that.fbZoomImg.src = that.currentItem.href;
that.setSize(
{ id: 'fbZoomDiv', width: that.pos.fbMainDiv.width, height: that.pos.fbMainDiv.height,
left: that.pos.fbBox.left + pad + that.padding, top: that.pos.fbBox.top + pad + that.upperSpace },
function() { that.zoomIn(1); } );
};
return this.fadeOpacity(this.fbOverlay, this.overlayOpacity, this.overlayFadeDuration, oncomplete);
}
if (phase === 1) {
var boxPos = {
left: this.pos.fbBox.left, top: this.pos.fbBox.top,
width: this.pos.fbBox.width, height: this.pos.fbBox.height
};
var pad = 2*(this.zoomPopBorder - this.outerBorder);
this.pos.fbBox = {
left: this.pos.fbZoomDiv.left, top: this.pos.fbZoomDiv.top,
width: this.pos.fbZoomDiv.width + pad, height: this.pos.fbZoomDiv.height + pad
};
this.fbBox.style.visibility = '';
var oncomplete = function() {
that.restore(function() { that.zoomIn(2); });
};
return this.setSize(
{ id: 'fbBox', left: boxPos.left, top: boxPos.top,
width: boxPos.width, height: boxPos.height},
oncomplete);
}
var show = function() {
zoomDiv.display = 'none';
that.fbZoomImg.src = '';
zoomDiv.left = zoomDiv.top = zoomDiv.width = zoomDiv.height = that.fbZoomImg.width = that.fbZoomImg.height = '0';
that.showContent();
};
this.timeouts.showContent = setTimeout(show, 10);
},
zoomOut: function(phase) {
var that = this;
if (!phase) {
this.fbZoomImg.src = this.currentItem.href;
var pad = this.outerBorder + this.innerBorder - this.zoomPopBorder;
this.setSize(
{ id: 'fbZoomDiv', width: this.pos.fbMainDiv.width, height: this.pos.fbMainDiv.height,
left: this.pos.fbBox.left + pad + this.padding, top: this.pos.fbBox.top + pad + this.upperSpace },
function() { that.zoomOut(1); } );
}
if (phase === 1) {
this.fbZoomDiv.style.display = this.fbZoomImg.style.display = '';
this.fbCanvas.style.visibility = 'hidden';
return this.collapse(function() { that.zoomOut(2); });
}
if (phase === 2) {
var pad = 2*(this.zoomPopBorder - this.outerBorder);
return this.setSize(
{ id: 'fbBox', left: this.pos.fbZoomDiv.left, top: this.pos.fbZoomDiv.top,
width: this.pos.fbZoomDiv.width + pad, height: this.pos.fbZoomDiv.height + pad },
function() { that.zoomOut(3); }
);
}
this.fbBox.style.visibility = 'hidden';
var end = function() {
that.fbZoomImg.src = that.pos.thumb.src;
that.end();
};
this.setSize(
{ id: 'fbZoomDiv', left: this.pos.thumb.left, top: this.pos.thumb.top,
width: this.pos.thumb.width, height: this.pos.thumb.height },
end);
},
setPause: function(pause) {
this.isPaused = pause;
if (pause) {
this.clearTimeout('slideshow');
} else {
this.newContent(this.nextIndex);
}
if (this.showPlayPause) {
this.fbPlay.style.top = pause ? '' : '-9999px';
this.fbPause.style.top = pause ? '-9999px' : '';
}
},
fadeOpacity: function(el, opacity, duration, callback) {
var startOp = +(el.style.opacity || 0);
duration = duration || 0;
this.clearTimeout['fade' + el.id];
var fadeIn = (startOp <= opacity && opacity > 0);
if (duration > 10) duration = 10;
if (duration < 0) duration = 0;
if (duration === 0) {
startOp = opacity;
var incr = 1;
} else {
var root = Math.pow(100, 0.1),
power = duration + ((10 - duration)/9) * (Math.log(2)/Math.log(root) - 1),
incr = 1/Math.pow(root, power);
}
if (fadeIn) {
el.style.display = el.style.visibility = '';
} else {
incr = -incr;
}
this.stepFade(el, startOp, opacity, incr, fadeIn, callback);
},
stepFade: function(el, thisOp, finishOp, incr, fadeIn, callback) {
if (!el) return;
var that = this;
if ((fadeIn && thisOp >= finishOp) || (!fadeIn && thisOp <= finishOp)) thisOp = finishOp;
if (this.ie) el.style.filter = 'alpha(opacity=' + thisOp*100 + ')';
el.style.opacity = thisOp + '';
if (thisOp === finishOp) {
if (this.ie && finishOp >= 1) el.style.removeAttribute('filter');
if (callback) callback();
} else {
this.timeouts['fade' + el.id] = setTimeout(function() { that.stepFade(el, thisOp + incr, finishOp, incr, fadeIn, callback); }, 20);
}
},
resizeGroup: function(arr, callback) {
var i = arr.length;
if (!i) return callback ? callback() : null;
this.clearTimeout('resize');
var diff = 0;
while (i--) {
diff = Math.max(diff, Math.abs(arr[i].finish - arr[i].start));
}
var duration = this.resizeDuration * (this.liveResize ? 0.65 : 1);
var rate = diff && duration ? Math.pow(Math.max(1, 2.2 - duration/10), (Math.log(diff))) / diff : 1;
i = arr.length;
while (i--) arr[i].diff = arr[i].finish - arr[i].start;
this.stepResize(rate, rate, arr, callback);
},
stepResize: function(increment, rate, arr, callback) {
var that = this;
if (increment > 1) increment = 1;
var i = arr.length;
while (i--) {
var node = arr[i].node,
prop = arr[i].property,
val = Math.round(arr[i].start + arr[i].diff * increment),
tag = node.tagName.toLowerCase();
if (tag === 'img' || tag === 'iframe') {
node[prop] = val;
} else {
node.style[prop] = val + 'px';
}
}
if (increment >= 1) {
delete this.timeouts.resize;
if (callback) callback();
} else {
this.timeouts.resize = setTimeout(function() { that.stepResize(increment + rate, rate, arr, callback); }, 20);
}
},
getDisplaySize: function() {
return { width: this.getDisplayWidth(), height: this.getDisplayHeight() };
},
getDisplayWidth: function() {
return this.html.clientWidth || this.bod.clientWidth;
},
getDisplayHeight: function() {
if (this.webkitOld) return window.innerHeight;
if (!this.html.clientHeight || this.operaOld || document.compatMode === 'BackCompat') {
return this.bod.clientHeight;
}
return this.html.clientHeight;
},
getScroll: function(win) {
if (!(win && win.document)) win = self;
var doc = win.document,
html = doc.documentElement,
bod = doc.body || doc.getElementsByTagName('body')[0],
left = win.pageXOffset || bod.scrollLeft || doc.documentElement.scrollLeft || 0;
if (this.ie && this.rtl) left -= html.scrollWidth - html.clientWidth;
return {
left: left,
top: win.pageYOffset || bod.scrollTop || doc.documentElement.scrollTop || 0
};
},
getLeftTop: function(el, local) {
var left = el.offsetLeft || 0,
top = el.offsetTop || 0,
doc = el.ownerDocument || el.document,
bod = doc.body || doc.getElementsByTagName('body')[0],
win = doc.defaultView || doc.parentWindow || doc.contentWindow,
scroll = this.getScroll(win),
position = this.getStyle(el, 'position', win),
rex = /absolute|fixed/,
elFlow = !rex.test(position),
inFlow = elFlow,
node = el;
if (position === 'fixed') {
left += scroll.left;
top += scroll.top;
}
while (position !== 'fixed' && (node = node.offsetParent)) {
var borderLeft = 0,
borderTop = 0,
nodeFlow = true,
position = this.getStyle(node, 'position', win),
nodeFlow = !rex.test(position);
if (this.opera) {
if (local && node !== bod) {
left += node.scrollLeft - node.clientLeft;
top += node.scrollTop - node.clientTop;
}
} else if (this.ie) {
if (node.currentStyle.hasLayout && node !== doc.documentElement) {
borderLeft = node.clientLeft;
borderTop = node.clientTop;
}
} else {
borderLeft = parseInt(this.getStyle(node, 'border-left-width', win), 10);
borderTop = parseInt(this.getStyle(node, 'border-top-width', win), 10);
if (this.ff && node === el.offsetParent && !nodeFlow && (this.ffOld || !elFlow)) {
left += borderLeft;
top += borderTop;
}
}
if (!nodeFlow) {
if (local) return { left: left, top: top };
inFlow = false;
}
if (node.offsetLeft > 0) left += node.offsetLeft;
left += borderLeft;
top += node.offsetTop + borderTop;
if (position === 'fixed') {
left += scroll.left;
top += scroll.top;
}
if (!(this.opera && elFlow) && node !== bod && node !== doc.documentElement) {
left -= node.scrollLeft;
top -= node.scrollTop;
}
}
if (this.ff && inFlow) {
left += parseInt(this.getStyle(bod, 'border-left-width', win), 10);
top += parseInt(this.getStyle(bod, 'border-top-width', win), 10);
}
if (this.webkitOld) {
var scriptElement = doc.createElement('script');
scriptElement.innerHTML = 'document.parentWindow=self';
doc.documentElement.appendChild(scriptElement);
doc.documentElement.removeChild(scriptElement);
win = doc.parentWindow;
}
if (!local && win !== self) {
var iframes = win.parent.document.getElementsByTagName('iframe'),
i = iframes.length;
while (i--) {
var node = iframes[i],
idoc = false;
try {
idoc = node.contentDocument || node.contentWindow;
idoc = idoc.document || idoc;
} catch(e) {}
if (idoc === doc || (typeof idoc !== 'object' && node.src === win.location.href.substr(win.location.href.length - node.src.length))) {
if (this.webkitOld) win = doc.defaultView;
var pos = this.getLeftTop(node);
left += pos.left - scroll.left;
top += pos.top - scroll.top;
if (this.ie || this.opera) {
var padLeft = 0, padTop = 0;
if (!this.ie || elFlow) {
padLeft = parseInt(this.getStyle(node, 'padding-left', win), 10);
padTop = parseInt(this.getStyle(node, 'padding-top', win), 10);
}
left += node.clientLeft + padLeft;
top += node.clientTop + padTop;
} else {
left += parseInt(this.getStyle(node, 'border-left-width', win), 10) +
parseInt(this.getStyle(node, 'padding-left', win), 10);
top += parseInt(this.getStyle(node, 'border-top-width', win), 10) +
parseInt(this.getStyle(node, 'padding-top', win), 10);
}
break;
}
}
}
return { left: left, top: top };
},
getStyle: function(el, prop, win) {
if (!(el && prop)) return '';
if (!win) {
var doc = el.ownerDocument || el.document;
win = doc.defaultView || doc.parentWindow || doc.contentWindow;
}
if (el.currentStyle) {
return el.currentStyle[prop.replace(/-(\w)/g, function(match, p1) { return p1.toUpperCase(); })] || '';
} else {
if (!win) {
var doc = el.ownerDocument || el.document;
win = doc.defaultView || doc.parentWindow || doc.contentWindow;
}
return (win.getComputedStyle && win.getComputedStyle(el, '').getPropertyValue(prop)) || '';
}
},
getLayout: function(el) {
var lay = this.getLeftTop(el);
lay.width = el.offsetWidth;
lay.height = el.offsetHeight;
return lay;
},
clearTimeout: function(key) {
if (this.timeouts[key]) {
clearTimeout(this.timeouts[key]);
delete this.timeouts[key];
}
},
stretchOverlay: function() {
var that = this;
return function() {
if (arguments.length === 1) {
that.clearTimeout('stretch');
that.timeouts.stretch = setTimeout(function() { that.stretchOverlay()(); }, 25);
} else {
delete that.timeouts.stretch;
if (!that.fbBox) return;
var width = that.fbBox.offsetLeft + that.fbBox.offsetWidth,
height = that.fbBox.offsetTop + that.fbBox.offsetHeight,
display = that.getDisplaySize(),
scroll = that.getScroll(),
overlay = that.fbOverlay.style;
overlay.width = overlay.height = '0';
var rtlAdjust = (that.rtl && scroll.left) ? that.html.clientWidth - that.html.scrollWidth : 0;
overlay.left = rtlAdjust + 'px';
overlay.width = Math.max(width, that.bod.scrollWidth, that.bod.clientWidth, that.html.clientWidth, display.width + scroll.left) + 'px';
overlay.height = Math.max(height, that.bod.scrollHeight, that.bod.clientHeight, that.html.clientHeight, display.height + scroll.top) + 'px';
}
};
},
encodeHTML: function(str) {
return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''');
},
decodeHTML: function(str) {
return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'");
},
getXMLHttpRequest: function() {
var xhr, that = this;
if (window.XMLHttpRequest) {
if (!(xhr = new XMLHttpRequest())) return false;
} else {
try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {
try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { return false; }
}
}
return {
getResponse: function(url, callback) {
try {
xhr.open('GET', url, true);
xhr.setRequestHeader('If-Modified-Since', 'Thu, 1 Jan 1970 00:00:00 GMT');
xhr.setRequestHeader('Cache-Control', 'no-cache');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
xhr.onreadystatechange = function() {};
callback(xhr);
}
};
xhr.send(null);
} catch(e) {}
}
};
},
setInnerHTML: function(el, strHTML) {
try {
var range = document.createRange();
range.selectNodeContents(el);
range.deleteContents();
if (strHTML) {
var xmlDiv = new DOMParser().parseFromString('' + strHTML + '
', 'application/xhtml+xml'),
childNodes = xmlDiv.documentElement.childNodes;
for (var i = 0, len = childNodes.length; i < len; i++) {
el.appendChild(document.importNode(childNodes[i], true));
}
}
return true;
} catch (e) {}
try {
el.innerHTML = strHTML;
return true;
} catch(e) {}
return false;
},
printContents: function(el, style) {
if (el && el.offsetWidth) {
var width = el.offsetWidth,
height = el.offsetHeight;
} else {
el = fb.lastChild.fbContent;
var pos = fb.lastChild.pos.fbMainDiv,
width = pos.width,
height = pos.height;
}
var win = window.open('', '', 'width=' + width + ', height=' + height),
doc = win && win.document;
if (!doc) {
alert('Popup windows are being blocked by your browser.\nUnable to print.');
return false;
}
if (/\.css$/i.test(style)) {
style = '';
} else {
style = '';
}
var div = document.createElement('div');
div.appendChild(el.cloneNode(true));
doc.open('text/html');
doc.write('' +
style + '' + div.innerHTML + '
');
doc.close();
setTimeout(function() { win && win.print(); win && win.close(); }, 200);
return true;
},
loadAnchor: function(href, rev, title) {
if (href.setAttribute) {
var anchor = href;
if (!anchor.getAttribute('rel')) anchor.setAttribute('rel', 'floatbox');
fb.lastChild.start(this.tagOneAnchor(anchor));
} else {
fb.lastChild.start(this.tagOneAnchor({ href: href, rev: rev, title: title, rel: 'floatbox' }));
}
},
goBack: function() {
var a = fb.previousAnchor;
if (a) this.loadAnchor(a.href, a.rev + ' sameBox:true', a.title);
},
resize: function(width, height) {
var changed = false;
if (width && fb.lastChild.currentItem && fb.lastChild.currentItem.nativeWidth != width) {
fb.lastChild.currentItem.nativeWidth = width;
changed = true;
}
if (height && fb.lastChild.currentItem && fb.lastChild.currentItem.nativeHeight != height) {
fb.lastChild.currentItem.nativeHeight = height;
changed = true;
}
if (changed) fb.lastChild.calcSize(false);
}
};
function initfb() {
if (arguments.callee.done) return;
var fbWindow = 'self';
if (self !== parent) {
try {
if (self.location.host === parent.location.host && self.location.protocol === parent.location.protocol) fbWindow = 'parent';
} catch(e) {}
if (fbWindow === 'parent' && !parent.fb) return setTimeout(initfb, 50);
}
arguments.callee.done = true;
if (document.compatMode === 'BackCompat') {
alert('Floatbox does not support quirks mode.\nPage needs to have a valid a doc type.');
return;
}
fb = (fbWindow === 'self' ? new Floatbox() : parent.fb);
fb.tagAnchors(self.document.body || self.document.getElementsByTagName('body')[0]);
if (fb.autoStart) {
fb.start(fb.autoStart);
if (typeof fb !== 'undefined') delete fb.autoStart;
} else {
fb.preloadImages('', true);
}
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', initfb, false);
}
(function() {
/*@cc_on
if (document.body) {
try {
document.createElement('div').doScroll('left');
return initfb();
} catch(e) {}
}
/*@if (false) @*/
if (/loaded|complete/.test(document.readyState)) return initfb();
/*@end @*/
if (!initfb.done) setTimeout(arguments.callee, 50);
})();
fb_prevOnload = window.onload;
window.onload = function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
if (typeof fb_prevOnload === 'function') fb_prevOnload();
initfb();
};