Академический Документы
Профессиональный Документы
Культура Документы
* Name:
Highslide JS
* Version: 4.1.13 (2011-10-06)
* Config: default
* Author: Torstein Hnsi
* Support: www.highslide.com/support
* License: www.highslide.com/#license
*/
if (!hs) { var hs = {
// Language strings
lang : {
cssDirection: 'ltr',
loadingText : 'Loading...',
loadingTitle : 'Click to cancel',
focusTitle : 'Click to bring to front',
fullExpandTitle : 'Expand to actual size (f)',
creditsText : 'Powered by <i>Highslide JS</i>',
creditsTitle : 'Go to the Highslide JS homepage',
restoreTitle : 'Click to close image, click and drag to move. Use arrow
keys for next and previous.'
},
// See http://highslide.com/ref for examples of settings
graphicsDir : 'highslide/graphics/',
expandCursor : 'zoomin.cur', // null disables
restoreCursor : 'zoomout.cur', // null disables
expandDuration : 250, // milliseconds
restoreDuration : 250,
marginLeft : 15,
marginRight : 15,
marginTop : 15,
marginBottom : 15,
zIndexCounter : 1001, // adjust to other absolutely positioned elements
loadingOpacity : 0.75,
allowMultipleInstances: true,
numberOfImagesToPreload : 5,
outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only
outlineStartOffset : 3, // ends at 10
padToMinWidth : false, // pad the popup width to make room for wide caption
fullExpandPosition : 'bottom right',
fullExpandOpacity : 1,
showCredits : true, // you can set this to false if you want
creditsHref : 'http://highslide.com/',
creditsTarget : '_self',
enableKeyListener : true,
openerTagNames : ['a'], // Add more to allow slideshow indexing
dragByHeading: true,
minWidth: 200,
minHeight: 200,
allowSizeReduction: true, // allow the image to reduce to fit client size. If fa
lse, this overrides minWidth and minHeight
outlineType : 'drop-shadow', // set null to disable outlines
// END OF YOUR SETTINGS
// declare internal properties
preloadTheseImages : [],
continuePreloading: true,
expanders : [],
overrides : [
'allowSizeReduction',
'useBox',
'outlineType',
'outlineWhileAnimating',
'captionId',
'captionText',
'captionEval',
'captionOverlay',
'headingId',
'headingText',
'headingEval',
'headingOverlay',
'creditsPosition',
'dragByHeading',
'width',
'height',
'wrapperClassName',
'minWidth',
'minHeight',
'maxWidth',
'maxHeight',
'pageOrigin',
'slideshowGroup',
'easing',
'easingClose',
'fadeInOut',
'src'
],
overlays : [],
idCounter : 0,
oPos : {
x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
y: ['above', 'top', 'middle', 'bottom', 'below']
},
mouse: {},
headingOverlay: {},
captionOverlay: {},
timers : [],
pendingOutlines : {},
clones : {},
onReady: [],
uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 :
parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[
\/: ]([\d.]+)/ ) || [0,'0'])[1]),
ie : (document.all && !window.opera),
//ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant?
safari : /Safari/.test(navigator.userAgent),
geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
$ : function (id) {
if (id) return document.getElementById(id);
},
push : function (arr, val) {
arr[arr.length] = val;
},
if (exp) {
zIndex = exp.wrapper.style.zIndex;
if (zIndex && zIndex > topZ) {
topZ = zIndex;
topmostKey = i;
}
}
}
if (topmostKey == -1) hs.focusKey = -1;
else expanders[topmostKey].focus();
},
getParam : function (a, param) {
a.getParams = a.onclick;
var p = a.getParams ? a.getParams() : null;
a.getParams = null;
return (p && typeof p[param] != 'undefined') ? p[param] :
(typeof hs[param] != 'undefined' ? hs[param] : null);
},
getSrc : function (a) {
var src = hs.getParam(a, 'src');
if (src) return src;
return a.href;
},
getNode : function (id) {
var node = hs.$(id), clone = hs.clones[id], a = {};
if (!node && !clone) return null;
if (!clone) {
clone = node.cloneNode(true);
clone.id = '';
hs.clones[id] = clone;
return node;
} else {
return clone.cloneNode(true);
}
},
discardElement : function(d) {
if (d) hs.garbageBin.appendChild(d);
hs.garbageBin.innerHTML = '';
},
transit : function (adj, exp) {
var last = exp || hs.getExpander();
exp = last;
if (hs.upcoming) return false;
else hs.last = last;
hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown',
hs.keyHandler);
try {
hs.upcoming = adj;
adj.onclick();
} catch (e){
hs.last = hs.upcoming = null;
}
try {
exp.close();
} catch (e) {}
return false;
},
previousOrNext : function (el, op) {
var exp = hs.getExpander(el);
if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp);
else return false;
},
previous : function (el) {
return hs.previousOrNext(el, -1);
},
next : function (el) {
return hs.previousOrNext(el, 1);
},
keyHandler : function(e) {
if (!e) e = window.event;
if (!e.target) e.target = e.srcElement; // ie
if (typeof e.target.form != 'undefined') return true; // form element ha
s focus
var exp = hs.getExpander();
var op = null;
switch (e.keyCode) {
case 70: // f
if (exp) exp.doFullExpand();
return true;
case 32: // Space
case 34: // Page Down
case 39: // Arrow right
case 40: // Arrow down
op = 1;
break;
case 8: // Backspace
case 33: // Page Up
case 37: // Arrow left
case 38: // Arrow up
op = -1;
break;
case 27: // Escape
case 13: // Enter
op = 0;
}
if (op !== null) {hs.removeEventListener(document, window.opera ? 'keypr
ess' : 'keydown', hs.keyHandler);
if (!hs.enableKeyListener) return true;
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
if (exp) {
if (op == 0) {
exp.close();
} else {
hs.previousOrNext(exp.key, op);
}
return false;
}
}
return true;
},
registerOverlay : function (overlay) {
hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ }
));
},
getWrapperKey : function (element, expOnly) {
var el, re = /^highslide-wrapper-([0-9]+)$/;
// 1. look in open expanders
el = element;
while (el.parentNode) {
if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
el = el.parentNode;
}
// 2. look in thumbnail
if (!expOnly) {
el = element;
while (el.parentNode) {
if (el.tagName && hs.isHsAnchor(el)) {
for (var key = 0; key < hs.expanders.length; key
++) {
var exp = hs.expanders[key];
if (exp && exp.a == el) return key;
}
}
el = el.parentNode;
}
}
return null;
},
getExpander : function (el, expOnly) {
if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
if (typeof el == 'number') return hs.expanders[el] || null;
if (typeof el == 'string') el = hs.$(el);
return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
},
isHsAnchor : function (a) {
return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.
(htmlE|e)xpand/));
},
reOrder : function () {
for (var i = 0; i < hs.expanders.length; i++)
if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmo
st();
},
mouseClickHandler : function(e)
{
if (!e) e = window.event;
if (e.button > 1) return true;
if (!e.target) e.target = e.srcElement;
var el = e.target;
while (el.parentNode
&& !(/highslide-(image|move|html|resize)/.test(el.className)))
{
el = el.parentNode;
}
var exp = hs.getExpander(el);
if (exp && (exp.isClosing || !exp.isExpanded)) return true;
if (exp && e.type == 'mousedown') {
if (e.target.form) return true;
var match = el.className.match(/highslide-(image|move|resize)/);
if (match) {
hs.dragArgs = {
exp: exp ,
type: match[1],
left: exp.x.pos,
width: exp.x.size,
top: exp.y.pos,
height: exp.y.size,
clickX: e.clientX,
clickY: e.clientY
};
hs.addEventListener(document, 'mousemove', hs.dragHandle
r);
if (e.preventDefault) e.preventDefault(); // FF
if (/highslide-(image|html)-blur/.test(exp.content.class
Name)) {
exp.focus();
hs.hasFocused = true;
}
return false;
}
} else if (e.type == 'mouseup') {
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
if (hs.dragArgs) {
if (hs.styleRestoreCursor && hs.dragArgs.type == 'image'
)
hs.dragArgs.exp.content.style.cursor = hs.styleR
estoreCursor;
var hasDragged = hs.dragArgs.hasDragged;
if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.tes
t(hs.dragArgs.type)) {
exp.close();
}
else if (hasDragged || (!hasDragged && hs.hasHtmlExpande
rs)) {
hs.dragArgs.exp.doShowHide('hidden');
}
hs.hasFocused = false;
hs.dragArgs = null;
} else if (/highslide-image-blur/.test(el.className)) {
el.style.cursor = hs.styleRestoreCursor;
}
}
return false;
},
dragHandler : function(e)
{
if (!hs.dragArgs) return true;
if (!e) e = window.event;
var a = hs.dragArgs, exp = a.exp;
a.dX = e.clientX - a.clickX;
a.dY = e.clientY - a.clickY;
var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
|| (distance > (hs.dragSensitivity || 5));
if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
if (a.type == 'resize') exp.resize(a);
else {
exp.moveTo(a.left + a.dX, a.top + a.dY);
if (a.type == 'image') exp.content.style.cursor = 'move'
;
}
}
return false;
},
wrapperMouseHandler : function (e) {
try {
if (!e) e = window.event;
var over = /mouseover/i.test(e.type);
if (!e.target) e.target = e.srcElement; // ie
if (!e.relatedTarget) e.relatedTarget =
over ? e.fromElement : e.toElement; // ie
var exp = hs.getExpander(e.target);
if (!exp.isExpanded) return;
if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget,
true) == exp
|| hs.dragArgs) return;
for (var i = 0; i < exp.overlays.length; i++) (function() {
var o = hs.$('hsId'+ exp.overlays[i]);
if (o && o.hideOnMouseOut) {
if (over) hs.setStyles(o, { visibility: 'visible
', display: '' });
hs.animate(o, { opacity: over ? o.opacity : 0 },
o.dur);
}
})();
} catch (e) {}
},
addEventListener : function (el, event, func) {
if (el == document && event == 'ready') {
hs.push(hs.onReady, func);
}
try {
el.addEventListener(event, func, false);
} catch (e) {
try {
hs.preloadFullImage(0);
// preload cursor
if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphi
csDir + hs.restoreCursor });
},
init : function () {
if (!hs.container) {
hs.ieLt7 = hs.ie && hs.uaVersion < 7;
hs.ieLt9 = hs.ie && hs.uaVersion < 9;
hs.getPageSize();
for (var x in hs.langDefaults) {
if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
else if (typeof hs.lang[x] == 'undefined' && typeof hs.l
angDefaults[x] != 'undefined')
hs.lang[x] = hs.langDefaults[x];
}
hs.container = hs.createElement('div', {
className: 'highslide-container'
}, {
position: 'absolute',
left: 0,
top: 0,
width: '100%',
zIndex: hs.zIndexCounter,
direction: 'ltr'
},
document.body,
true
);
hs.loading = hs.createElement('a', {
className: 'highslide-loading',
title: hs.lang.loadingTitle,
innerHTML: hs.lang.loadingText,
href: 'javascript:;'
}, {
position: 'absolute',
top: '-9999px',
opacity: hs.loadingOpacity,
zIndex: 1
}, hs.container
);
hs.garbageBin = hs.createElement('div', null, { display: 'none'
}, hs.container);
// http://www.robertpenner.com/easing/
Math.linearTween = function (t, b, c, d) {
return c*t/d + b;
};
Math.easeInQuad = function (t, b, c, d) {
return c*(t/=d)*t + b;
};
hs.hideSelects = hs.ieLt7;
hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigato
r.vendor == 'KDE'
|| (hs.ieLt7 && hs.uaVersion < 5.5));
}
},
ready : function() {
if (hs.isReady) return;
hs.isReady = true;
for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
},
updateAnchors : function() {
var el, els, all = [], images = [],groups = {}, re;
for (var i = 0; i < hs.openerTagNames.length; i++) {
els = document.getElementsByTagName(hs.openerTagNames[i]);
for (var j = 0; j < els.length; j++) {
el = els[j];
re = hs.isHsAnchor(el);
if (re) {
hs.push(all, el);
if (re[0] == 'hs.expand') hs.push(images, el);
var g = hs.getParam(el, 'slideshowGroup') || 'no
ne';
if (!groups[g]) groups[g] = [];
hs.push(groups[g], el);
}
}
}
hs.anchors = { all: all, groups: groups, images: images };
return hs.anchors;
},
getAnchors : function() {
return hs.anchors || hs.updateAnchors();
},
close : function(el) {
var exp = hs.getExpander(el);
if (exp) exp.close();
return false;
}
}; // end hs object
hs.fx = function( elem, options, prop ){
this.options = options;
this.elem = elem;
this.prop = prop;
if (!options.orig) options.orig = {};
};
hs.fx.prototype = {
update: function(){
(hs.fx.step[this.prop] || hs.fx.step._default)(this);
if (this.options.step)
this.options.step.call(this.elem, this.now, this);
},
custom: function(from, to, unit){
this.startTime = (new Date()).getTime();
this.start = from;
this.end = to;
this.unit = unit;// || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
var self = this;
function t(gotoEnd){
return self.step(gotoEnd);
}
t.elem = this.elem;
else
fx.elem[ fx.prop ] = fx.now;
} catch (e) {}
}
}
});
hs.Outline = function (outlineType, onLoad) {
this.onLoad = onLoad;
this.outlineType = outlineType;
var v = hs.uaVersion, tr;
this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
if (!outlineType) {
if (onLoad) onLoad();
return;
}
hs.init();
this.table = hs.createElement(
'table', {
cellSpacing: 0
}, {
visibility: 'hidden',
position: 'absolute',
borderCollapse: 'collapse',
width: 0
},
hs.container,
true
);
var tbody = hs.createElement('tbody', null, null, this.table, 1);
this.td = [];
for (var i = 0; i <= 8; i++) {
if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'aut
o' }, tbody, true);
this.td[i] = hs.createElement('td', null, null, tr, true);
var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position
: 'relative' };
hs.setStyles(this.td[i], style);
}
this.td[4].className = outlineType +' highslide-outline';
this.preloadGraphic();
};
hs.Outline.prototype = {
preloadGraphic : function () {
var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outline
Type +".png";
var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
this.graphic = hs.createElement('img', null, { position: 'absolute',
top: '-9999px' }, appendTo, true); // for onload trigger
var pThis = this;
this.graphic.onload = function() { pThis.onGraphicLoad(); };
this.graphic.src = src;
},
onGraphicLoad : function () {
var o = this.offset = this.graphic.width / 4,
pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2
]],
dim = { height: (2*o) +'px', width: (2*o) +'px' };
for (var i = 0; i <= 8; i++) {
if (pos[i]) {
if (this.hasAlphaImageLoader) {
var w = (i == 1 || i == 7) ? '100%' : this.graph
ic.width +'px';
var div = hs.createElement('div', null, { width:
'100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i],
true);
hs.createElement ('div', null, {
filter: "progid:DXImageTransform
.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
position: 'absolute',
width: w,
height: this.graphic.height +'px
',
left: (pos[i][0]*o)+'px',
top: (pos[i][1]*o)+'px'
},
div,
true);
} else {
hs.setStyles(this.td[i], { background: 'url('+ t
his.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
}
if (window.opera && (i == 3 || i ==5))
hs.createElement('div', null, dim, this.td[i], t
rue);
hs.setStyles (this.td[i], dim);
}
}
this.graphic = null;
if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlin
eType].destroy();
hs.pendingOutlines[this.outlineType] = this;
if (this.onLoad) this.onLoad();
},
setPosition : function (pos, offset, vis, dur, easing) {
var exp = this.exp,
stl = exp.wrapper.style,
offset = offset || 0,
pos = pos || {
x: exp.x.pos + offset,
y: exp.y.pos + offset,
w: exp.x.get('wsize') - 2 * offset,
h: exp.y.get('wsize') - 2 * offset
};
if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
? 'visible' : 'hidden';
hs.setStyles(this.table, {
};
hs.Expander = function(a, params, custom, contentType) {
if (document.readyState && hs.ie && !hs.isReady) {
hs.addEventListener(document, 'ready', function() {
new hs.Expander(a, params, custom, contentType);
});
return;
}
this.a = a;
this.custom = custom;
this.contentType = contentType || 'image';
this.isImage = !this.isHtml;
hs.continuePreloading = false;
this.overlays = [];
hs.init();
var key = this.key = hs.expanders.length;
// override inline parameters
for (var i = 0; i < hs.overrides.length; i++) {
var name = hs.overrides[i];
this[name] = params && typeof params[name] != 'undefined' ?
params[name] : hs[name];
}
if (!this.src) this.src = a.href;
// get thumb
var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
el = this.thumb = el.getElementsByTagName('img')[0] || el;
this.thumbsUserSetId = el.id || a.id;
// check if already open
for (var i = 0; i < hs.expanders.length; i++) {
if (hs.expanders[i] && hs.expanders[i].a == a) {
hs.expanders[i].focus();
return false;
}
}
// cancel other
if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.lengt
h; i++) {
if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expand
ers[i].onLoadStarted) {
hs.expanders[i].cancelLoading();
}
}
hs.expanders[key] = this;
if (!hs.allowMultipleInstances && !hs.upcoming) {
if (hs.expanders[key-1]) hs.expanders[key-1].close();
if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKe
y])
hs.expanders[hs.focusKey].close();
}
// initiate metrics
this.el = el;
this.tpos = this.pageOrigin || hs.getPosition(el);
hs.getPageSize();
var x = this.x = new hs.Dimension(this, 'x');
x.calcThumb();
var y = this.y = new hs.Dimension(this, 'y');
y.calcThumb();
this.wrapper = hs.createElement(
'div', {
id: 'highslide-wrapper-'+ this.key,
className: 'highslide-wrapper '+ this.wrapperClassName
}, {
visibility: 'hidden',
position: 'absolute',
zIndex: hs.zIndexCounter += 2
}, null, true );
this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHand
ler;
if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
this.outlineWhileAnimating = 0;
// get the outline
if (!this.outlineType) {
this[this.contentType +'Create']();
} else if (hs.pendingOutlines[this.outlineType]) {
this.connectOutline();
this[this.contentType +'Create']();
} else {
this.showLoading();
var exp = this;
new hs.Outline(this.outlineType,
function () {
exp.connectOutline();
exp[exp.contentType +'Create']();
}
);
}
return true;
};
hs.Expander.prototype = {
error : function(e) {
if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message);
else window.location.href = this.src;
},
connectOutline : function() {
var outline = this.outline = hs.pendingOutlines[this.outlineType];
outline.exp = this;
outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
hs.pendingOutlines[this.outlineType] = null;
},
showLoading : function() {
if (this.onLoadStarted || this.loading) return;
this.loading = hs.loading;
var exp = this;
this.loading.onclick = function() {
exp.cancelLoading();
};
hs.setStyles (this.wrapper, {
left: (x.tpos + x.tb - x.cb) +'px',
top: (y.tpos + x.tb - y.cb) +'px'
});
this.getOverlays();
var ratio = x.full / y.full;
x.calcExpanded();
this.justify(x);
y.calcExpanded();
this.justify(y);
if (this.overlayBox) this.sizeOverlayBox(0, 1);
if (this.allowSizeReduction) {
this.correctRatio(ratio);
if (this.isImage && this.x.full > (this.x.imgSize || thi
s.x.size)) {
this.createFullExpand();
if (this.overlays.length == 1) this.sizeOverlayB
ox();
}
}
this.show();
} catch (e) {
this.error(e);
}
},
justify : function (p, moveOnly) {
var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
var hasMovedMin = false;
var allowReduce = p.exp.allowSizeReduction;
p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2))
;
if (p.pos < p.scroll + p.marginMin) {
p.pos = p.scroll + p.marginMin;
hasMovedMin = true;
}
if (!moveOnly && p.size < p.minSize) {
p.size = p.minSize;
allowReduce = false;
}
if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginM
ax) {
if (!moveOnly && hasMovedMin && allowReduce) {
p.size = Math.min(p.size, p.get(dim == 'y' ? 'fi
tsize' : 'maxsize'));
} else if (p.get('wsize') < p.get('fitsize')) {
p.pos = p.scroll + p.clientSize - p.marginMax p.get('wsize');
} else { // image larger than viewport
p.pos = p.scroll + p.marginMin;
if (!moveOnly && allowReduce) p.size = p.get(dim
== 'y' ? 'fitsize' : 'maxsize');
}
}
if (!moveOnly && p.size < p.minSize) {
p.size = p.minSize;
allowReduce = false;
}
afterExpand : function() {
this.isExpanded = true;
this.focus();
if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
this.prepareNextOutline();
var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scr
ollTop;
this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsiz
e')
&& this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
if (this.overlayBox) this.showOverlays();
},
prepareNextOutline : function() {
var key = this.key;
var outlineType = this.outlineType;
new hs.Outline(outlineType,
function () { try { hs.expanders[key].preloadNext(); } catch (e)
{} });
},
preloadNext : function() {
var next = this.getAdjacentAnchor(1);
if (next && next.onclick.toString().match(/hs\.expand/))
var img = hs.createElement('img', { src: hs.getSrc(next) });
},
getAdjacentAnchor : function(op) {
var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slidesh
owGroup || 'none'];
return (as && as[current + op]) || null;
},
getAnchorIndex : function() {
var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
if (arr) for (var i = 0; i < arr.length; i++) {
if (arr[i] == this.a) return i;
}
return null;
},
cancelLoading : function() {
hs.discardElement (this.wrapper);
hs.expanders[this.key] = null;
if (this.loading) hs.loading.style.left = '-9999px';
},
writeCredits : function () {
this.credits = hs.createElement('a', {
href: hs.creditsHref,
target: hs.creditsTarget,
className: 'highslide-credits',
innerHTML: hs.lang.creditsText,
title: hs.lang.creditsTitle
});
this.createOverlay({
overlayId: this.credits,
position: this.creditsPosition || 'top left'
});
},
getInline : function(types, addOverlay) {
for (var i = 0; i < types.length; i++) {
var type = types[i], s = null;
if (!this[type +'Id'] && this.thumbsUserSetId)
this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
'');
els[i].setAttribute('hidden-by', hiddenBy);
if (!hiddenBy) els[i].style[prop] = els[i].origP
rop;
} else if (visibility == 'hidden') { // hide if behind
var elPos = hs.getPosition(els[i]);
elPos.w = els[i].offsetWidth;
elPos.h = els[i].offsetHeight;
var clearsX = (elPos.x + elPos.w < this.
x.get('opos')
|| elPos.x > this.x.get('opos')
+ this.x.get('osize'));
var clearsY = (elPos.y + elPos.h < this.
y.get('opos')
|| elPos.y > this.y.get('opos')
+ this.y.get('osize'));
var wrapperKey = hs.getWrapperKey(els[i]);
if (!clearsX && !clearsY && wrapperKey != this.k
ey) { // element falls behind image
if (!hiddenBy) {
els[i].setAttribute('hidden-by',
'['+ this.key +']');
els[i].origProp = els[i].style[p
rop];
els[i].style[prop] = 'hidden';
} else if (hiddenBy.indexOf('['+ this.ke
y +']') == -1) {
els[i].setAttribute('hidden-by',
hiddenBy + '['+ this.key +']');
}
} else if ((hiddenBy == '['+ this.key +']' || hs
.focusKey == wrapperKey)
&& wrapperKey != this.key) { //
on move
els[i].setAttribute('hidden-by', '');
els[i].style[prop] = els[i].origProp ||
'';
} else if (hiddenBy && hiddenBy.indexOf('['+ thi
s.key +']') > -1) {
els[i].setAttribute('hidden-by', hiddenB
y.replace('['+ this.key +']', ''));
}
}
}
}
},
focus : function() {
this.wrapper.style.zIndex = hs.zIndexCounter += 2;
// blur others
for (var i = 0; i < hs.expanders.length; i++) {
if (hs.expanders[i] && i == hs.focusKey) {
var blurExp = hs.expanders[i];
blurExp.content.className += ' highslide-'+ blurExp.cont
entType +'-blur';
blurExp.content.style.cursor = hs.ieLt7 ? 'hand'
: 'pointer';
blurExp.content.title = hs.lang.focusTitle;
}
}
// focus this
if (this.outline) this.outline.table.style.zIndex
= this.wrapper.style.zIndex - 1;
this.content.className = 'highslide-'+ this.contentType;
this.content.title = hs.lang.restoreTitle;
if (hs.restoreCursor) {
hs.styleRestoreCursor = window.opera ? 'pointer' : 'url(
'+ hs.graphicsDir + hs.restoreCursor +'), pointer';
if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor
= 'hand';
this.content.style.cursor = hs.styleRestoreCursor;
}
hs.focusKey = this.key;
hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.
keyHandler);
},
moveTo: function(x, y) {
this.x.setPos(x);
this.y.setPos(y);
},
resize : function (e) {
var w, h, r = e.width / e.height;
w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
h = w / r;
if (h < Math.min(this.minHeight, this.y.full)) {
h = Math.min(this.minHeight, this.y.full);
if (this.isImage) w = h * r;
}
this.resizeTo(w, h);
},
resizeTo: function(w, h) {
this.y.setSize(h);
this.x.setSize(w);
this.wrapper.style.height = this.y.get('wsize') +'px';
},
close : function() {
if (this.isClosing || !this.isExpanded) return;
this.isClosing = true;
hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown',
hs.keyHandler);
try {
this.content.style.cursor = 'default';
this.changeSize(
0, {
wrapper: {
width : this.x.t,
height : this.y.t,
left: this.x.tpos - this.x.cb + this.x.t
b,
offY = overlay.offsetY;
if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(o
verlay);
if (/left$/.test(p)) overlay.style.left = offX +'px';
if (/center$/.test(p)) hs.setStyles (overlay, {
left: '50%',
marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
});
if (/right$/.test(p)) overlay.style.right = - offX +'px';
if (/^leftpanel$/.test(p)) {
hs.setStyles(overlay, {
right: '100%',
marginRight: this.x.cb +'px',
top: - this.y.cb +'px',
bottom: - this.y.cb +'px',
overflow: 'auto'
});
this.x.p1 = overlay.offsetWidth;
} else if (/^rightpanel$/.test(p)) {
hs.setStyles(overlay, {
left: '100%',
marginLeft: this.x.cb +'px',
top: - this.y.cb +'px',
bottom: - this.y.cb +'px',
overflow: 'auto'
});
this.x.p2 = overlay.offsetWidth;
}
if (/^top/.test(p)) overlay.style.top = offY +'px';
if (/^middle/.test(p)) hs.setStyles (overlay, {
top: '50%',
marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
});
if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
if (/^above$/.test(p)) {
hs.setStyles(overlay, {
left: (- this.x.p1 - this.x.cb) +'px',
right: (- this.x.p2 - this.x.cb) +'px',
bottom: '100%',
marginBottom: this.y.cb +'px',
width: 'auto'
});
this.y.p1 = overlay.offsetHeight;
} else if (/^below$/.test(p)) {
hs.setStyles(overlay, {
position: 'relative',
left: (- this.x.p1 - this.x.cb) +'px',
right: (- this.x.p2 - this.x.cb) +'px',
top: '100%',
marginTop: this.y.cb +'px',
width: 'auto'
});
this.y.p2 = overlay.offsetHeight;
overlay.style.position = 'absolute';
}
},
getOverlays : function() {
this.getInline(['heading', 'caption'], true);
if (this.heading && this.dragByHeading) this.heading.className += ' high
slide-move';
if (hs.showCredits) this.writeCredits();
for (var i = 0; i < hs.overlays.length; i++) {
var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGro
up;
if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
|| (sg && sg === this.slideshowGroup)) {
this.createOverlay(o);
}
}
var os = [];
for (var i = 0; i < this.overlays.length; i++) {
var o = hs.$('hsId'+ this.overlays[i]);
if (/panel$/.test(o.position)) this.positionOverlay(o);
else hs.push(os, o);
}
for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
this.gotOverlays = true;
},
genOverlayBox : function() {
if (!this.overlayBox) this.overlayBox = hs.createElement (
'div', {
className: this.wrapperClassName
}, {
position : 'absolute',
width: (this.x.size || (this.useBox ? this.width : null)
|| this.x.full) +'px',
height: (this.y.size || this.y.full) +'px',
visibility : 'hidden',
overflow : 'hidden',
zIndex : hs.ie ? 4 : 'auto'
},
hs.container,
true
);
},
sizeOverlayBox : function(doWrapper, doPanels) {
var overlayBox = this.overlayBox,
x = this.x,
y = this.y;
hs.setStyles( overlayBox, {
width: x.size +'px',
height: y.size +'px'
});
if (doWrapper || doPanels) {
for (var i = 0; i < this.overlays.length; i++) {
var o = hs.$('hsId'+ this.overlays[i]);
var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompa
t');
if (o && /^(above|below)$/.test(o.position)) {
if (ie6) {
o.style.width = (overlayBox.offsetWidth
+ 2 * x.cb
createFullExpand : function () {
this.fullExpandLabel = hs.createElement(
'a', {
href: 'javascript:hs.expanders['+ this.key +'].doFullExp
and();',
title: hs.lang.fullExpandTitle,
className: 'highslide-full-expand'
}
);
this.createOverlay({
overlayId: this.fullExpandLabel,
position: hs.fullExpandPosition,
hideOnMouseOut: true,
opacity: hs.fullExpandOpacity
});
},
doFullExpand : function () {
try {
if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel
);
this.focus();
var xSize = this.x.size,
ySize = this.y.size;
this.resizeTo(this.x.full, this.y.full);
var xpos = this.x.pos - (this.x.size - xSize) / 2;
if (xpos < hs.marginLeft) xpos = hs.marginLeft;
var ypos = this.y.pos - (this.y.size - ySize) / 2;
if (ypos < hs.marginTop) ypos = hs.marginTop;
this.moveTo(xpos, ypos);
this.doShowHide('hidden');
} catch (e) {
this.error(e);
}
},
afterClose : function () {
this.a.className = this.a.className.replace('highslide-active-anchor', '
');
this.doShowHide('visible');
if (this.outline && this.outlineWhileAnimating) this.outline.des
troy();
hs.discardElement(this.wrapper);
hs.expanders[this.key] = null;
hs.reOrder();
}
};
hs.langDefaults = hs.lang;
// history
var HsExpander = hs.Expander;
if (hs.ie && window == window.top) {
(function () {
try {
document.documentElement.doScroll('left');
} catch (e) {
setTimeout(arguments.callee, 50);
return;
}
hs.ready();
})();
}
hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
hs.addEventListener(window, 'load', hs.ready);
// set handlers
hs.addEventListener(document, 'ready', function() {
if (hs.expandCursor) {
var style = hs.createElement('style', { type: 'text/css' }, null
,
document.getElementsByTagName('HEAD')[0]),
backCompat = document.compatMode == 'BackCompat';
function addRule(sel, dec) {
if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
var last = document.styleSheets[document.styleSh
eets.length - 1];
if (typeof(last.addRule) == "object") last.addRu
le(sel, dec);
} else {
style.appendChild(document.createTextNode(sel +
" {" + dec + "}"));
}
}
function fix(prop) {
return 'expression( ( ( ignoreMe = document.documentElem
ent.'+ prop +
' ? document.documentElement.'+ prop +' : docume
nt.body.'+ prop +' ) ) + \'px\' );';
}
if (hs.expandCursor) addRule ('.highslide img',
'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), po
inter !important;');
}
});
hs.addEventListener(window, 'resize', function() {
hs.getPageSize();
});
hs.addEventListener(document, 'mousemove', function(e) {
hs.mouse = { x: e.clientX, y: e.clientY };
});
hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
hs.addEventListener(document, 'ready', hs.getAnchors);
hs.addEventListener(window, 'load', hs.preloadImages);
}