3 * Version: 4.1.13 (2011-10-06)
4 * Config: default +events +slideshow +positioning +transitions +viewport +thumbstrip
5 * Author: Torstein Hønsi
6 * Support: www.highslide.com/support
7 * License: www.highslide.com/#license
13 loadingText : 'Loading...',
14 loadingTitle : 'Click to cancel',
15 focusTitle : 'Click to bring to front',
16 fullExpandTitle : 'Expand to actual size (f)',
17 creditsText : 'Powered by <i>Highslide JS</i>',
18 creditsTitle : 'Go to the Highslide JS homepage',
19 previousText : 'Previous',
23 closeTitle : 'Close (esc)',
24 resizeTitle : 'Resize',
26 playTitle : 'Play slideshow (spacebar)',
28 pauseTitle : 'Pause slideshow (spacebar)',
29 previousTitle : 'Previous (arrow left)',
30 nextTitle : 'Next (arrow right)',
32 fullExpandText : '1:1',
33 number: 'Image %1 of %2',
34 restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
36 // See http://highslide.com/ref for examples of settings
37 graphicsDir : 'highslide/graphics/',
38 expandCursor : 'zoomin.cur', // null disables
39 restoreCursor : 'zoomout.cur', // null disables
40 expandDuration : 250, // milliseconds
41 restoreDuration : 250,
46 zIndexCounter : 1001, // adjust to other absolutely positioned elements
47 loadingOpacity : 0.75,
48 allowMultipleInstances: true,
49 numberOfImagesToPreload : 5,
50 outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only
51 outlineStartOffset : 3, // ends at 10
52 padToMinWidth : false, // pad the popup width to make room for wide caption
53 fullExpandPosition : 'bottom right',
54 fullExpandOpacity : 1,
55 showCredits : true, // you can set this to false if you want
56 creditsHref : 'http://highslide.com/',
57 creditsTarget : '_self',
58 enableKeyListener : true,
59 openerTagNames : ['a'], // Add more to allow slideshow indexing
61 transitionDuration: 250,
62 dimmingOpacity: 0, // Lightbox style dimming background
63 dimmingDuration: 50, // 0 for instant dimming
65 anchor : 'auto', // where the image expands from
66 align : 'auto', // position in the client (overrides anchor)
67 targetX: null, // the id of a target element
72 allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight
73 outlineType : 'drop-shadow', // set null to disable outlines
76 '<div class="highslide-controls"><ul>'+
77 '<li class="highslide-previous">'+
78 '<a href="#" title="{hs.lang.previousTitle}">'+
79 '<span>{hs.lang.previousText}</span></a>'+
81 '<li class="highslide-play">'+
82 '<a href="#" title="{hs.lang.playTitle}">'+
83 '<span>{hs.lang.playText}</span></a>'+
85 '<li class="highslide-pause">'+
86 '<a href="#" title="{hs.lang.pauseTitle}">'+
87 '<span>{hs.lang.pauseText}</span></a>'+
89 '<li class="highslide-next">'+
90 '<a href="#" title="{hs.lang.nextTitle}">'+
91 '<span>{hs.lang.nextText}</span></a>'+
93 '<li class="highslide-move">'+
94 '<a href="#" title="{hs.lang.moveTitle}">'+
95 '<span>{hs.lang.moveText}</span></a>'+
97 '<li class="highslide-full-expand">'+
98 '<a href="#" title="{hs.lang.fullExpandTitle}">'+
99 '<span>{hs.lang.fullExpandText}</span></a>'+
101 '<li class="highslide-close">'+
102 '<a href="#" title="{hs.lang.closeTitle}" >'+
103 '<span>{hs.lang.closeText}</span></a>'+
107 // END OF YOUR SETTINGS
110 // declare internal properties
111 preloadTheseImages : [],
112 continuePreloading: true,
115 'allowSizeReduction',
122 'outlineWhileAnimating',
156 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
157 y: ['above', 'top', 'middle', 'bottom', 'below']
166 pendingOutlines : {},
169 uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 :
170 parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]),
171 ie : (document.all && !window.opera),
172 //ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant?
173 safari : /Safari/.test(navigator.userAgent),
174 geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
177 if (id) return document.getElementById(id);
180 push : function (arr, val) {
181 arr[arr.length] = val;
184 createElement : function (tag, attribs, styles, parent, nopad) {
185 var el = document.createElement(tag);
186 if (attribs) hs.extend(el, attribs);
187 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
188 if (styles) hs.setStyles(el, styles);
189 if (parent) parent.appendChild(el);
193 extend : function (el, attribs) {
194 for (var x in attribs) el[x] = attribs[x];
198 setStyles : function (el, styles) {
199 for (var x in styles) {
200 if (hs.ieLt9 && x == 'opacity') {
201 if (styles[x] > 0.99) el.style.removeAttribute('filter');
202 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
204 else el.style[x] = styles[x];
207 animate: function(el, prop, opt) {
211 if (typeof opt != 'object' || opt === null) {
212 var args = arguments;
219 if (typeof opt.duration != 'number') opt.duration = 250;
220 opt.easing = Math[opt.easing] || Math.easeInQuad;
221 opt.curAnim = hs.extend({}, prop);
222 for (var name in prop) {
223 var e = new hs.fx(el, opt , name );
225 start = parseFloat(hs.css(el, name)) || 0;
226 end = parseFloat(prop[name]);
227 unit = name != 'opacity' ? 'px' : '';
229 e.custom( start, end, unit );
232 css: function(el, prop) {
233 if (el.style[prop]) {
234 return el.style[prop];
235 } else if (document.defaultView) {
236 return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);
239 if (prop == 'opacity') prop = 'filter';
240 var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
241 if (prop == 'filter')
242 val = val.replace(/alpha\(opacity=([0-9]+)\)/,
243 function (a, b) { return b / 100 });
244 return val === '' ? 1 : val;
248 getPageSize : function () {
249 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat'
250 ? d.documentElement : d.body,
251 ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined');
253 var width = ieLt9 ? iebody.clientWidth :
254 (d.documentElement.clientWidth || self.innerWidth),
255 height = ieLt9 ? iebody.clientHeight : self.innerHeight;
259 scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset,
260 scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset
265 getPosition : function(el) {
266 var p = { x: el.offsetLeft, y: el.offsetTop };
267 while (el.offsetParent) {
268 el = el.offsetParent;
269 p.x += el.offsetLeft;
271 if (el != document.body && el != document.documentElement) {
272 p.x -= el.scrollLeft;
279 expand : function(a, params, custom, type) {
280 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
281 if (typeof a.getParams == 'function') return params;
283 new hs.Expander(a, params, custom);
285 } catch (e) { return true; }
287 getElementByClass : function (el, tagName, className) {
288 var els = el.getElementsByTagName(tagName);
289 for (var i = 0; i < els.length; i++) {
290 if ((new RegExp(className)).test(els[i].className)) {
296 replaceLang : function(s) {
297 s = s.replace(/\s/g, ' ');
298 var re = /{hs\.lang\.([^}]+)\}/g,
299 matches = s.match(re),
301 if (matches) for (var i = 0; i < matches.length; i++) {
302 lang = matches[i].replace(re, "$1");
303 if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]);
309 focusTopmost : function() {
312 expanders = hs.expanders,
315 for (var i = 0; i < expanders.length; i++) {
318 zIndex = exp.wrapper.style.zIndex;
319 if (zIndex && zIndex > topZ) {
325 if (topmostKey == -1) hs.focusKey = -1;
326 else expanders[topmostKey].focus();
329 getParam : function (a, param) {
330 a.getParams = a.onclick;
331 var p = a.getParams ? a.getParams() : null;
334 return (p && typeof p[param] != 'undefined') ? p[param] :
335 (typeof hs[param] != 'undefined' ? hs[param] : null);
338 getSrc : function (a) {
339 var src = hs.getParam(a, 'src');
344 getNode : function (id) {
345 var node = hs.$(id), clone = hs.clones[id], a = {};
346 if (!node && !clone) return null;
348 clone = node.cloneNode(true);
350 hs.clones[id] = clone;
353 return clone.cloneNode(true);
357 discardElement : function(d) {
358 if (d) hs.garbageBin.appendChild(d);
359 hs.garbageBin.innerHTML = '';
361 dim : function(exp) {
364 hs.dimmer = hs.createElement ('div', {
365 className: 'highslide-dimming highslide-viewport-size',
367 onclick: function() {
368 if (hs.fireEvent(hs, 'onDimmerClick'))
373 visibility: 'visible',
375 }, hs.container, true);
377 if (/(Android|iPad|iPhone|iPod)/.test(navigator.userAgent)) {
378 var body = document.body;
379 function pixDimmerSize() {
380 hs.setStyles(hs.dimmer, {
381 width: body.scrollWidth +'px',
382 height: body.scrollHeight +'px'
386 hs.addEventListener(window, 'resize', pixDimmerSize);
389 hs.dimmer.style.display = '';
391 var isNew = hs.dimmer.owner == '';
392 hs.dimmer.owner += '|'+ exp.key;
395 if (hs.geckoMac && hs.dimmingGeckoFix)
396 hs.setStyles(hs.dimmer, {
397 background: 'url('+ hs.graphicsDir + 'geckodimmer.png)',
401 hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration);
404 undim : function(key) {
405 if (!hs.dimmer) return;
406 if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, '');
409 (typeof key != 'undefined' && hs.dimmer.owner != '')
410 || (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
413 if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none';
414 else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() {
415 hs.dimmer.style.display = 'none';
418 transit : function (adj, exp) {
419 var last = exp || hs.getExpander();
421 if (hs.upcoming) return false;
423 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
428 hs.last = hs.upcoming = null;
431 if (!adj || exp.transitions[1] != 'crossfade')
437 previousOrNext : function (el, op) {
438 var exp = hs.getExpander(el);
439 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp);
443 previous : function (el) {
444 return hs.previousOrNext(el, -1);
447 next : function (el) {
448 return hs.previousOrNext(el, 1);
451 keyHandler : function(e) {
452 if (!e) e = window.event;
453 if (!e.target) e.target = e.srcElement; // ie
454 if (typeof e.target.form != 'undefined') return true; // form element has focus
455 if (!hs.fireEvent(hs, 'onKeyDown', e)) return true;
456 var exp = hs.getExpander();
461 if (exp) exp.doFullExpand();
466 case 34: // Page Down
467 case 39: // Arrow right
468 case 40: // Arrow down
473 case 37: // Arrow left
481 if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
482 if (!hs.enableKeyListener) return true;
484 if (e.preventDefault) e.preventDefault();
485 else e.returnValue = false;
489 } else if (op == 2) {
490 if (exp.slideshow) exp.slideshow.hitSpace();
492 if (exp.slideshow) exp.slideshow.pause();
493 hs.previousOrNext(exp.key, op);
502 registerOverlay : function (overlay) {
503 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } ));
507 addSlideshow : function (options) {
508 var sg = options.slideshowGroup;
509 if (typeof sg == 'object') {
510 for (var i = 0; i < sg.length; i++) {
512 for (var x in options) o[x] = options[x];
513 o.slideshowGroup = sg[i];
514 hs.push(hs.slideshows, o);
517 hs.push(hs.slideshows, options);
521 getWrapperKey : function (element, expOnly) {
522 var el, re = /^highslide-wrapper-([0-9]+)$/;
523 // 1. look in open expanders
525 while (el.parentNode) {
526 if (el.hsKey !== undefined) return el.hsKey;
527 if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
530 // 2. look in thumbnail
533 while (el.parentNode) {
534 if (el.tagName && hs.isHsAnchor(el)) {
535 for (var key = 0; key < hs.expanders.length; key++) {
536 var exp = hs.expanders[key];
537 if (exp && exp.a == el) return key;
546 getExpander : function (el, expOnly) {
547 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
548 if (typeof el == 'number') return hs.expanders[el] || null;
549 if (typeof el == 'string') el = hs.$(el);
550 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
553 isHsAnchor : function (a) {
554 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
557 reOrder : function () {
558 for (var i = 0; i < hs.expanders.length; i++)
559 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
561 fireEvent : function (obj, evt, args) {
562 return obj && obj[evt] ? (obj[evt](obj, args) !== false) : true;
565 mouseClickHandler : function(e)
567 if (!e) e = window.event;
568 if (e.button > 1) return true;
569 if (!e.target) e.target = e.srcElement;
573 && !(/highslide-(image|move|html|resize)/.test(el.className)))
577 var exp = hs.getExpander(el);
578 if (exp && (exp.isClosing || !exp.isExpanded)) return true;
580 if (exp && e.type == 'mousedown') {
581 if (e.target.form) return true;
582 var match = el.className.match(/highslide-(image|move|resize)/);
596 hs.addEventListener(document, 'mousemove', hs.dragHandler);
597 if (e.preventDefault) e.preventDefault(); // FF
599 if (/highslide-(image|html)-blur/.test(exp.content.className)) {
601 hs.hasFocused = true;
605 } else if (e.type == 'mouseup') {
607 hs.removeEventListener(document, 'mousemove', hs.dragHandler);
610 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image')
611 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
612 var hasDragged = hs.dragArgs.hasDragged;
614 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
615 if (hs.fireEvent(exp, 'onImageClick'))
618 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
619 hs.dragArgs.exp.doShowHide('hidden');
622 if (hasDragged) hs.fireEvent(hs.dragArgs.exp, 'onDrop', hs.dragArgs);
623 hs.hasFocused = false;
626 } else if (/highslide-image-blur/.test(el.className)) {
627 el.style.cursor = hs.styleRestoreCursor;
633 dragHandler : function(e)
635 if (!hs.dragArgs) return true;
636 if (!e) e = window.event;
637 var a = hs.dragArgs, exp = a.exp;
639 a.dX = e.clientX - a.clickX;
640 a.dY = e.clientY - a.clickY;
642 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
643 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
644 || (distance > (hs.dragSensitivity || 5));
646 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
647 if (!hs.fireEvent(exp, 'onDrag', a)) return false;
649 if (a.type == 'resize') exp.resize(a);
651 exp.moveTo(a.left + a.dX, a.top + a.dY);
652 if (a.type == 'image') exp.content.style.cursor = 'move';
658 wrapperMouseHandler : function (e) {
660 if (!e) e = window.event;
661 var over = /mouseover/i.test(e.type);
662 if (!e.target) e.target = e.srcElement; // ie
663 if (!e.relatedTarget) e.relatedTarget =
664 over ? e.fromElement : e.toElement; // ie
665 var exp = hs.getExpander(e.target);
666 if (!exp.isExpanded) return;
667 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp
668 || hs.dragArgs) return;
669 hs.fireEvent(exp, over ? 'onMouseOver' : 'onMouseOut', e);
670 for (var i = 0; i < exp.overlays.length; i++) (function() {
671 var o = hs.$('hsId'+ exp.overlays[i]);
672 if (o && o.hideOnMouseOut) {
673 if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
674 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
679 addEventListener : function (el, event, func) {
680 if (el == document && event == 'ready') {
681 hs.push(hs.onReady, func);
684 el.addEventListener(event, func, false);
687 el.detachEvent('on'+ event, func);
688 el.attachEvent('on'+ event, func);
690 el['on'+ event] = func;
695 removeEventListener : function (el, event, func) {
697 el.removeEventListener(event, func, false);
700 el.detachEvent('on'+ event, func);
702 el['on'+ event] = null;
707 preloadFullImage : function (i) {
708 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
709 var img = document.createElement('img');
710 img.onload = function() {
712 hs.preloadFullImage(i + 1);
714 img.src = hs.preloadTheseImages[i];
717 preloadImages : function (number) {
718 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
720 var arr = hs.getAnchors();
721 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
722 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
726 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
729 hs.preloadFullImage(0);
732 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
739 hs.ieLt7 = hs.ie && hs.uaVersion < 7;
740 hs.ieLt9 = hs.ie && hs.uaVersion < 9;
743 for (var x in hs.langDefaults) {
744 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
745 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined')
746 hs.lang[x] = hs.langDefaults[x];
749 hs.container = hs.createElement('div', {
750 className: 'highslide-container'
752 position: 'absolute',
756 zIndex: hs.zIndexCounter,
762 hs.loading = hs.createElement('a', {
763 className: 'highslide-loading',
764 title: hs.lang.loadingTitle,
765 innerHTML: hs.lang.loadingText,
768 position: 'absolute',
770 opacity: hs.loadingOpacity,
774 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
775 hs.viewport = hs.createElement('div', {
776 className: 'highslide-viewport highslide-viewport-size'
778 visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden'
782 // http://www.robertpenner.com/easing/
783 Math.linearTween = function (t, b, c, d) {
786 Math.easeInQuad = function (t, b, c, d) {
787 return c*(t/=d)*t + b;
789 Math.easeOutQuad = function (t, b, c, d) {
790 return -c *(t/=d)*(t-2) + b;
793 hs.hideSelects = hs.ieLt7;
794 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE'
795 || (hs.ieLt7 && hs.uaVersion < 5.5));
796 hs.fireEvent(this, 'onActivate');
800 if (hs.isReady) return;
802 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
805 updateAnchors : function() {
806 var el, els, all = [], images = [],groups = {}, re;
808 for (var i = 0; i < hs.openerTagNames.length; i++) {
809 els = document.getElementsByTagName(hs.openerTagNames[i]);
810 for (var j = 0; j < els.length; j++) {
812 re = hs.isHsAnchor(el);
815 if (re[0] == 'hs.expand') hs.push(images, el);
816 var g = hs.getParam(el, 'slideshowGroup') || 'none';
817 if (!groups[g]) groups[g] = [];
818 hs.push(groups[g], el);
822 hs.anchors = { all: all, groups: groups, images: images };
827 getAnchors : function() {
828 return hs.anchors || hs.updateAnchors();
832 close : function(el) {
833 var exp = hs.getExpander(el);
834 if (exp) exp.close();
838 hs.fx = function( elem, options, prop ){
839 this.options = options;
843 if (!options.orig) options.orig = {};
847 (hs.fx.step[this.prop] || hs.fx.step._default)(this);
849 if (this.options.step)
850 this.options.step.call(this.elem, this.now, this);
853 custom: function(from, to, unit){
854 this.startTime = (new Date()).getTime();
857 this.unit = unit;// || this.unit || "px";
858 this.now = this.start;
859 this.pos = this.state = 0;
863 return self.step(gotoEnd);
868 if ( t() && hs.timers.push(t) == 1 ) {
869 hs.timerId = setInterval(function(){
870 var timers = hs.timers;
872 for ( var i = 0; i < timers.length; i++ )
874 timers.splice(i--, 1);
876 if ( !timers.length ) {
877 clearInterval(hs.timerId);
882 step: function(gotoEnd){
883 var t = (new Date()).getTime();
884 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
886 this.pos = this.state = 1;
889 this.options.curAnim[ this.prop ] = true;
892 for ( var i in this.options.curAnim )
893 if ( this.options.curAnim[i] !== true )
897 if (this.options.complete) this.options.complete.call(this.elem);
901 var n = t - this.startTime;
902 this.state = n / this.options.duration;
903 this.pos = this.options.easing(n, 0, 1, this.options.duration);
904 this.now = this.start + ((this.end - this.start) * this.pos);
915 opacity: function(fx){
916 hs.setStyles(fx.elem, { opacity: fx.now });
919 _default: function(fx){
921 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
922 fx.elem.style[ fx.prop ] = fx.now + fx.unit;
924 fx.elem[ fx.prop ] = fx.now;
930 hs.Outline = function (outlineType, onLoad) {
931 this.onLoad = onLoad;
932 this.outlineType = outlineType;
933 var v = hs.uaVersion, tr;
935 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
937 if (onLoad) onLoad();
942 this.table = hs.createElement(
946 visibility: 'hidden',
947 position: 'absolute',
948 borderCollapse: 'collapse',
954 var tbody = hs.createElement('tbody', null, null, this.table, 1);
957 for (var i = 0; i <= 8; i++) {
958 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
959 this.td[i] = hs.createElement('td', null, null, tr, true);
960 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
961 hs.setStyles(this.td[i], style);
963 this.td[4].className = outlineType +' highslide-outline';
965 this.preloadGraphic();
968 hs.Outline.prototype = {
969 preloadGraphic : function () {
970 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
972 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
973 this.graphic = hs.createElement('img', null, { position: 'absolute',
974 top: '-9999px' }, appendTo, true); // for onload trigger
977 this.graphic.onload = function() { pThis.onGraphicLoad(); };
979 this.graphic.src = src;
982 onGraphicLoad : function () {
983 var o = this.offset = this.graphic.width / 4,
984 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
985 dim = { height: (2*o) +'px', width: (2*o) +'px' };
986 for (var i = 0; i <= 8; i++) {
988 if (this.hasAlphaImageLoader) {
989 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
990 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
991 hs.createElement ('div', null, {
992 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
993 position: 'absolute',
995 height: this.graphic.height +'px',
996 left: (pos[i][0]*o)+'px',
997 top: (pos[i][1]*o)+'px'
1002 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
1005 if (window.opera && (i == 3 || i ==5))
1006 hs.createElement('div', null, dim, this.td[i], true);
1008 hs.setStyles (this.td[i], dim);
1011 this.graphic = null;
1012 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
1013 hs.pendingOutlines[this.outlineType] = this;
1014 if (this.onLoad) this.onLoad();
1017 setPosition : function (pos, offset, vis, dur, easing) {
1019 stl = exp.wrapper.style,
1020 offset = offset || 0,
1022 x: exp.x.pos + offset,
1023 y: exp.y.pos + offset,
1024 w: exp.x.get('wsize') - 2 * offset,
1025 h: exp.y.get('wsize') - 2 * offset
1027 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
1028 ? 'visible' : 'hidden';
1029 hs.setStyles(this.table, {
1030 left: (pos.x - this.offset) +'px',
1031 top: (pos.y - this.offset) +'px',
1032 width: (pos.w + 2 * this.offset) +'px'
1035 pos.w -= 2 * this.offset;
1036 pos.h -= 2 * this.offset;
1037 hs.setStyles (this.td[4], {
1038 width: pos.w >= 0 ? pos.w +'px' : 0,
1039 height: pos.h >= 0 ? pos.h +'px' : 0
1041 if (this.hasAlphaImageLoader) this.td[3].style.height
1042 = this.td[5].style.height = this.td[4].style.height;
1046 destroy : function(hide) {
1047 if (hide) this.table.style.visibility = 'hidden';
1048 else hs.discardElement(this.table);
1052 hs.Dimension = function(exp, dim) {
1055 this.ucwh = dim == 'x' ? 'Width' : 'Height';
1056 this.wh = this.ucwh.toLowerCase();
1057 this.uclt = dim == 'x' ? 'Left' : 'Top';
1058 this.lt = this.uclt.toLowerCase();
1059 this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
1060 this.rb = this.ucrb.toLowerCase();
1061 this.p1 = this.p2 = 0;
1063 hs.Dimension.prototype = {
1064 get : function(key) {
1067 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
1068 case 'loadingPosXfade':
1069 return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2;
1071 return this.size + 2 * this.cb + this.p1 + this.p2;
1073 return this.clientSize - this.marginMin - this.marginMax;
1075 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
1077 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
1079 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
1081 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
1085 calcBorders: function() {
1086 // correct for borders
1087 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
1089 this.marginMax = hs['margin'+ this.ucrb];
1091 calcThumb: function() {
1092 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) :
1093 this.exp.el['offset'+ this.ucwh];
1094 this.tpos = this.exp.tpos[this.dim];
1095 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
1096 if (this.tpos == 0 || this.tpos == -1) {
1097 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];
1100 calcExpanded: function() {
1102 this.justify = 'auto';
1105 if (exp.align == 'center') this.justify = 'center';
1106 else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null;
1107 else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max';
1110 // size and position
1111 this.pos = this.tpos - this.cb + this.tb;
1113 if (this.maxHeight && this.dim == 'x')
1114 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full);
1116 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
1117 this.minSize = exp.allowSizeReduction ?
1118 Math.min(exp['min'+ this.ucwh], this.full) :this.full;
1119 if (exp.isImage && exp.useBox) {
1120 this.size = exp[this.wh];
1121 this.imgSize = this.full;
1123 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
1124 this.target = exp['target'+ this.dim.toUpperCase()];
1125 this.marginMin = hs['margin'+ this.uclt];
1126 this.scroll = hs.page['scroll'+ this.uclt];
1127 this.clientSize = hs.page[this.wh];
1129 setSize: function(i) {
1131 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
1133 this.size = Math.max(this.size, this.imgSize);
1134 exp.content.style[this.lt] = this.get('imgPad')+'px';
1138 exp.content.style[this.wh] = i +'px';
1139 exp.wrapper.style[this.wh] = this.get('wsize') +'px';
1140 if (exp.outline) exp.outline.setPosition();
1141 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
1142 if (this.dim == 'x' && exp.slideshow && exp.isImage) {
1143 if (i == this.full) exp.slideshow.disable('full-expand');
1144 else exp.slideshow.enable('full-expand');
1147 setPos: function(i) {
1149 this.exp.wrapper.style[this.lt] = i +'px';
1151 if (this.exp.outline) this.exp.outline.setPosition();
1156 hs.Expander = function(a, params, custom, contentType) {
1157 if (document.readyState && hs.ie && !hs.isReady) {
1158 hs.addEventListener(document, 'ready', function() {
1159 new hs.Expander(a, params, custom, contentType);
1164 this.custom = custom;
1165 this.contentType = contentType || 'image';
1166 this.isImage = !this.isHtml;
1168 hs.continuePreloading = false;
1170 this.last = hs.last;
1173 var key = this.key = hs.expanders.length;
1174 // override inline parameters
1175 for (var i = 0; i < hs.overrides.length; i++) {
1176 var name = hs.overrides[i];
1177 this[name] = params && typeof params[name] != 'undefined' ?
1178 params[name] : hs[name];
1180 if (!this.src) this.src = a.href;
1183 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
1184 el = this.thumb = el.getElementsByTagName('img')[0] || el;
1185 this.thumbsUserSetId = el.id || a.id;
1186 if (!hs.fireEvent(this, 'onInit')) return true;
1188 // check if already open
1189 for (var i = 0; i < hs.expanders.length; i++) {
1190 if (hs.expanders[i] && hs.expanders[i].a == a
1191 && !(this.last && this.transitions[1] == 'crossfade')) {
1192 hs.expanders[i].focus();
1198 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
1199 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
1200 hs.expanders[i].cancelLoading();
1203 hs.expanders[key] = this;
1204 if (!hs.allowMultipleInstances && !hs.upcoming) {
1205 if (hs.expanders[key-1]) hs.expanders[key-1].close();
1206 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
1207 hs.expanders[hs.focusKey].close();
1212 this.tpos = this.pageOrigin || hs.getPosition(el);
1214 var x = this.x = new hs.Dimension(this, 'x');
1216 var y = this.y = new hs.Dimension(this, 'y');
1218 this.wrapper = hs.createElement(
1220 id: 'highslide-wrapper-'+ this.key,
1221 className: 'highslide-wrapper '+ this.wrapperClassName
1223 visibility: 'hidden',
1224 position: 'absolute',
1225 zIndex: hs.zIndexCounter += 2
1228 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
1229 if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
1230 this.outlineWhileAnimating = 0;
1233 if (!this.outlineType
1234 || (this.last && this.isImage && this.transitions[1] == 'crossfade')) {
1235 this[this.contentType +'Create']();
1237 } else if (hs.pendingOutlines[this.outlineType]) {
1238 this.connectOutline();
1239 this[this.contentType +'Create']();
1244 new hs.Outline(this.outlineType,
1246 exp.connectOutline();
1247 exp[exp.contentType +'Create']();
1254 hs.Expander.prototype = {
1255 error : function(e) {
1256 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message);
1257 else window.location.href = this.src;
1260 connectOutline : function() {
1261 var outline = this.outline = hs.pendingOutlines[this.outlineType];
1263 outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
1264 hs.pendingOutlines[this.outlineType] = null;
1267 showLoading : function() {
1268 if (this.onLoadStarted || this.loading) return;
1270 this.loading = hs.loading;
1272 this.loading.onclick = function() {
1273 exp.cancelLoading();
1277 if (!hs.fireEvent(this, 'onShowLoading')) return;
1279 l = this.x.get('loadingPos') +'px',
1280 t = this.y.get('loadingPos') +'px';
1281 if (!tgt && this.last && this.transitions[1] == 'crossfade')
1282 var tgt = this.last;
1284 l = tgt.x.get('loadingPosXfade') +'px';
1285 t = tgt.y.get('loadingPosXfade') +'px';
1286 this.loading.style.zIndex = hs.zIndexCounter++;
1288 setTimeout(function () {
1289 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
1293 imageCreate : function() {
1296 var img = document.createElement('img');
1298 img.onload = function () {
1299 if (hs.expanders[exp.key]) exp.contentLoaded();
1301 if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
1302 img.className = 'highslide-image';
1304 visibility: 'hidden',
1306 position: 'absolute',
1310 img.title = hs.lang.restoreTitle;
1311 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
1312 if (hs.ie && hs.flushImgSize) img.src = null;
1318 contentLoaded : function() {
1320 if (!this.content) return;
1321 this.content.onload = null;
1322 if (this.onLoadStarted) return;
1323 else this.onLoadStarted = true;
1325 var x = this.x, y = this.y;
1328 hs.setStyles(this.loading, { top: '-9999px' });
1329 this.loading = null;
1330 hs.fireEvent(this, 'onHideLoading');
1332 x.full = this.content.width;
1333 y.full = this.content.height;
1335 hs.setStyles(this.content, {
1339 this.wrapper.appendChild(this.content);
1340 hs.container.appendChild(this.wrapper);
1345 hs.setStyles (this.wrapper, {
1346 left: (x.tpos + x.tb - x.cb) +'px',
1347 top: (y.tpos + x.tb - y.cb) +'px'
1351 this.initSlideshow();
1354 var ratio = x.full / y.full;
1360 if (this.overlayBox) this.sizeOverlayBox(0, 1);
1363 if (this.allowSizeReduction) {
1364 this.correctRatio(ratio);
1365 var ss = this.slideshow;
1366 if (ss && this.last && ss.controls && ss.fixedControls) {
1367 var pos = ss.overlayOptions.position || '', p;
1368 for (var dim in hs.oPos) for (var i = 0; i < 5; i++) {
1370 if (pos.match(hs.oPos[dim][i])) {
1371 p.pos = this.last[dim].pos
1372 + (this.last[dim].p1 - p.p1)
1373 + (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i];
1374 if (ss.fixedControls == 'fit') {
1375 if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
1376 p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2;
1377 if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin;
1382 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
1383 this.createFullExpand();
1384 if (this.overlays.length == 1) this.sizeOverlayBox();
1394 justify : function (p, moveOnly) {
1395 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
1397 if (tgt && tgt.match(/ /)) {
1398 tgtArr = tgt.split(' ');
1401 if (tgt && hs.$(tgt)) {
1402 p.pos = hs.getPosition(hs.$(tgt))[dim];
1403 if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/))
1404 p.pos += parseInt(tgtArr[1]);
1405 if (p.size < p.minSize) p.size = p.minSize;
1407 } else if (p.justify == 'auto' || p.justify == 'center') {
1409 var hasMovedMin = false;
1411 var allowReduce = p.exp.allowSizeReduction;
1412 if (p.justify == 'center')
1413 p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2);
1415 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
1416 if (p.pos < p.scroll + p.marginMin) {
1417 p.pos = p.scroll + p.marginMin;
1420 if (!moveOnly && p.size < p.minSize) {
1422 allowReduce = false;
1424 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
1425 if (!moveOnly && hasMovedMin && allowReduce) {
1426 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize'));
1427 } else if (p.get('wsize') < p.get('fitsize')) {
1428 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
1429 } else { // image larger than viewport
1430 p.pos = p.scroll + p.marginMin;
1431 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
1435 if (!moveOnly && p.size < p.minSize) {
1437 allowReduce = false;
1441 } else if (p.justify == 'max') {
1442 p.pos = Math.floor(p.pos - p.size + p.t);
1446 if (p.pos < p.marginMin) {
1448 p.pos = p.marginMin;
1450 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
1455 correctRatio : function(ratio) {
1459 xSize = Math.min(x.full, x.size),
1460 ySize = Math.min(y.full, y.size),
1461 useBox = (this.useBox || hs.padToMinWidth);
1463 if (xSize / ySize > ratio) { // width greater
1464 xSize = ySize * ratio;
1465 if (xSize < x.minSize) { // below minWidth
1467 ySize = xSize / ratio;
1471 } else if (xSize / ySize < ratio) { // height greater
1472 ySize = xSize / ratio;
1476 if (hs.padToMinWidth && x.full < x.minSize) {
1478 y.size = y.imgSize = y.full;
1479 } else if (this.useBox) {
1486 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed);
1487 if (useBox && y.size < y.imgSize) {
1489 x.imgSize = y.size * ratio;
1491 if (changed || useBox) {
1492 x.pos = x.tpos - x.cb + x.tb;
1494 this.justify(x, true);
1496 y.pos = y.tpos - y.cb + y.tb;
1498 this.justify(y, true);
1499 if (this.overlayBox) this.sizeOverlayBox();
1504 fitOverlayBox : function(ratio, changed) {
1505 var x = this.x, y = this.y;
1506 if (this.overlayBox) {
1507 while (y.size > this.minHeight && x.size > this.minWidth
1508 && y.get('wsize') > y.get('fitsize')) {
1510 if (ratio) x.size = y.size * ratio;
1511 this.sizeOverlayBox(0, 1);
1518 show : function () {
1519 var x = this.x, y = this.y;
1520 this.doShowHide('hidden');
1521 hs.fireEvent(this, 'onBeforeExpand');
1522 if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb();
1524 // Apply size change
1528 width : x.get('wsize'),
1529 height : y.get('wsize'),
1534 left: x.p1 + x.get('imgPad'),
1535 top: y.p1 + y.get('imgPad'),
1536 width:x.imgSize ||x.size,
1537 height:y.imgSize ||y.size
1544 changeSize : function(up, to, dur) {
1546 var trans = this.transitions,
1547 other = up ? (this.last ? this.last.a : null) : hs.upcoming,
1548 t = (trans[1] && other
1549 && hs.getParam(other, 'transitions')[1] == trans[1]) ?
1550 trans[1] : trans[0];
1552 if (this[t] && t != 'expand') {
1557 if (this.outline && !this.outlineWhileAnimating) {
1558 if (up) this.outline.setPosition();
1559 else this.outline.destroy();
1563 if (!up) this.destroyOverlays();
1568 easing = this.easing;
1569 if (!up) easing = this.easingClose || easing;
1573 if (exp.outline) exp.outline.table.style.visibility = "visible";
1574 setTimeout(function() {
1581 if (up) hs.setStyles( this.wrapper, {
1585 if (this.fadeInOut) {
1586 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
1587 hs.extend(to.wrapper, { opacity: up });
1589 hs.animate( this.wrapper, to.wrapper, {
1592 step: function(val, args) {
1593 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
1594 var fac = up ? args.pos : 1 - args.pos;
1596 w: x.t + (x.get('wsize') - x.t) * fac,
1597 h: y.t + (y.get('wsize') - y.t) * fac,
1598 x: x.tpos + (x.pos - x.tpos) * fac,
1599 y: y.tpos + (y.pos - y.tpos) * fac
1601 exp.outline.setPosition(pos, 0, 1);
1605 hs.animate( this.content, to.content, dur, easing, after);
1607 this.wrapper.style.visibility = 'visible';
1608 this.content.style.visibility = 'visible';
1609 this.a.className += ' highslide-active-anchor';
1615 fade : function(up, to) {
1616 this.outlineWhileAnimating = false;
1617 var exp = this, t = up ? hs.expandDuration : 0;
1620 hs.animate(this.wrapper, to.wrapper, 0);
1621 hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' });
1622 hs.animate(this.content, to.content, 0);
1623 this.content.style.visibility = 'visible';
1625 hs.animate(this.wrapper, { opacity: 1 }, t, null,
1626 function() { exp.afterExpand(); });
1630 this.outline.table.style.zIndex = this.wrapper.style.zIndex;
1632 offset = this.outline.offset,
1633 startOff = up ? 3 : offset,
1634 endOff = up? offset : 3;
1635 for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) {
1637 var o = up ? endOff - i : startOff - i;
1638 setTimeout(function() {
1639 exp.outline.setPosition(0, o, 1);
1646 if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50);
1648 setTimeout( function() {
1649 if (exp.outline) exp.outline.destroy(exp.preserveContent);
1651 exp.destroyOverlays();
1653 hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){
1659 crossfade : function (up, to, from) {
1667 wrapper = this.wrapper,
1668 content = this.content,
1669 overlayBox = this.overlayBox;
1670 hs.removeEventListener(document, 'mousemove', hs.dragHandler);
1672 hs.setStyles(content, {
1673 width: (x.imgSize || x.size) +'px',
1674 height: (y.imgSize || y.size) +'px'
1676 if (overlayBox) overlayBox.style.overflow = 'visible';
1677 this.outline = last.outline;
1678 if (this.outline) this.outline.exp = exp;
1679 last.outline = null;
1680 var fadeBox = hs.createElement('div', {
1681 className: 'highslide-'+ this.contentType
1683 position: 'absolute',
1689 var names = { oldImg: last, newImg: this };
1690 for (var n in names) {
1691 this[n] = names[n].content.cloneNode(1);
1692 hs.setStyles(this[n], {
1693 position: 'absolute',
1695 visibility: 'visible'
1697 fadeBox.appendChild(this[n]);
1699 wrapper.appendChild(fadeBox);
1701 overlayBox.className = '';
1702 wrapper.appendChild(overlayBox);
1704 fadeBox.style.display = '';
1705 last.content.style.display = 'none';
1708 if (hs.safari && hs.uaVersion < 525) {
1709 this.wrapper.style.visibility = 'visible';
1711 hs.animate(wrapper, {
1714 duration: hs.transitionDuration,
1715 step: function(val, args) {
1720 props = ['pos', 'size', 'p1', 'p2'];
1721 for (var n in props) {
1723 size['x'+ prop] = Math.round(invPos * lastX[prop] + pos * x[prop]);
1724 size['y'+ prop] = Math.round(invPos * lastY[prop] + pos * y[prop]);
1725 size.ximgSize = Math.round(
1726 invPos * (lastX.imgSize || lastX.size) + pos * (x.imgSize || x.size));
1727 size.ximgPad = Math.round(invPos * lastX.get('imgPad') + pos * x.get('imgPad'));
1728 size.yimgSize = Math.round(
1729 invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size));
1730 size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad'));
1732 if (exp.outline) exp.outline.setPosition({
1735 w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb,
1736 h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb
1738 last.wrapper.style.clip = 'rect('
1739 + (size.ypos - lastY.pos)+'px, '
1740 + (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, '
1741 + (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, '
1742 + (size.xpos - lastX.pos)+'px)';
1744 hs.setStyles(content, {
1745 top: (size.yp1 + y.get('imgPad')) +'px',
1746 left: (size.xp1 + x.get('imgPad')) +'px',
1747 marginTop: (y.pos - size.ypos) +'px',
1748 marginLeft: (x.pos - size.xpos) +'px'
1750 hs.setStyles(wrapper, {
1751 top: size.ypos +'px',
1752 left: size.xpos +'px',
1753 width: (size.xp1 + size.xp2 + size.xsize + 2 * x.cb)+ 'px',
1754 height: (size.yp1 + size.yp2 + size.ysize + 2 * y.cb) + 'px'
1756 hs.setStyles(fadeBox, {
1757 width: (size.ximgSize || size.xsize) + 'px',
1758 height: (size.yimgSize || size.ysize) +'px',
1759 left: (size.xp1 + size.ximgPad) +'px',
1760 top: (size.yp1 + size.yimgPad) +'px',
1761 visibility: 'visible'
1764 hs.setStyles(exp.oldImg, {
1765 top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px',
1766 left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px'
1769 hs.setStyles(exp.newImg, {
1771 top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px',
1772 left: (x.pos - size.xpos + x.p1 - size.xp1 + x.get('imgPad') - size.ximgPad) +'px'
1774 if (overlayBox) hs.setStyles(overlayBox, {
1775 width: size.xsize + 'px',
1776 height: size.ysize +'px',
1777 left: (size.xp1 + x.cb) +'px',
1778 top: (size.yp1 + y.cb) +'px'
1781 complete: function () {
1782 wrapper.style.visibility = content.style.visibility = 'visible';
1783 content.style.display = 'block';
1784 hs.discardElement(fadeBox);
1792 reuseOverlay : function(o, el) {
1793 if (!this.last) return false;
1794 for (var i = 0; i < this.last.overlays.length; i++) {
1795 var oDiv = hs.$('hsId'+ this.last.overlays[i]);
1796 if (oDiv && oDiv.hsId == o.hsId) {
1797 this.genOverlayBox();
1798 oDiv.reuse = this.key;
1799 hs.push(this.overlays, this.last.overlays[i]);
1807 afterExpand : function() {
1808 this.isExpanded = true;
1810 if (this.dimmingOpacity) hs.dim(this);
1811 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
1812 this.prepareNextOutline();
1813 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
1814 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
1815 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
1816 if (this.overlayBox) this.showOverlays();
1817 hs.fireEvent(this, 'onAfterExpand');
1822 prepareNextOutline : function() {
1824 var outlineType = this.outlineType;
1825 new hs.Outline(outlineType,
1826 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
1830 preloadNext : function() {
1831 var next = this.getAdjacentAnchor(1);
1832 if (next && next.onclick.toString().match(/hs\.expand/))
1833 var img = hs.createElement('img', { src: hs.getSrc(next) });
1837 getAdjacentAnchor : function(op) {
1838 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];
1839 if (as && !as[current + op] && this.slideshow && this.slideshow.repeat) {
1840 if (op == 1) return as[0];
1841 else if (op == -1) return as[as.length-1];
1843 return (as && as[current + op]) || null;
1846 getAnchorIndex : function() {
1847 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
1848 if (arr) for (var i = 0; i < arr.length; i++) {
1849 if (arr[i] == this.a) return i;
1855 getNumber : function() {
1856 if (this[this.numberPosition]) {
1857 var arr = hs.anchors.groups[this.slideshowGroup || 'none'];
1859 var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length);
1860 this[this.numberPosition].innerHTML =
1861 '<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML;
1865 initSlideshow : function() {
1867 for (var i = 0; i < hs.slideshows.length; i++) {
1868 var ss = hs.slideshows[i], sg = ss.slideshowGroup;
1869 if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup)
1870 this.slideshow = new hs.Slideshow(this.key, ss);
1873 this.slideshow = this.last.slideshow;
1875 var ss = this.slideshow;
1877 var key = ss.expKey = this.key;
1879 ss.checkFirstAndLast();
1880 ss.disable('full-expand');
1882 this.createOverlay(hs.extend(ss.overlayOptions || {}, {
1883 overlayId: ss.controls,
1888 if (ss.thumbstrip) ss.thumbstrip.add(this);
1889 if (!this.last && this.autoplay) ss.play(true);
1891 ss.autoplay = setTimeout(function() {
1893 }, (ss.interval || 500));
1897 cancelLoading : function() {
1898 hs.discardElement (this.wrapper);
1899 hs.expanders[this.key] = null;
1900 if (hs.upcoming == this.a) hs.upcoming = null;
1902 if (this.loading) hs.loading.style.left = '-9999px';
1903 hs.fireEvent(this, 'onHideLoading');
1906 writeCredits : function () {
1907 if (this.credits) return;
1908 this.credits = hs.createElement('a', {
1909 href: hs.creditsHref,
1910 target: hs.creditsTarget,
1911 className: 'highslide-credits',
1912 innerHTML: hs.lang.creditsText,
1913 title: hs.lang.creditsTitle
1915 this.createOverlay({
1916 overlayId: this.credits,
1917 position: this.creditsPosition || 'top left',
1922 getInline : function(types, addOverlay) {
1923 for (var i = 0; i < types.length; i++) {
1924 var type = types[i], s = null;
1925 if (type == 'caption' && !hs.fireEvent(this, 'onBeforeGetCaption')) return;
1926 else if (type == 'heading' && !hs.fireEvent(this, 'onBeforeGetHeading')) return;
1927 if (!this[type +'Id'] && this.thumbsUserSetId)
1928 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
1929 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
1930 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
1931 s = eval(this[type +'Eval']);
1933 if (!this[type] && this[type +'Text']) {
1934 s = this[type +'Text'];
1936 if (!this[type] && !s) {
1937 this[type] = hs.getNode(this.a['_'+ type + 'Id']);
1939 var next = this.a.nextSibling;
1940 while (next && !hs.isHsAnchor(next)) {
1941 if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
1942 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++;
1943 this[type] = hs.getNode(next.id);
1946 next = next.nextSibling;
1950 if (!this[type] && !s && this.numberPosition == type) s = '\n';
1952 if (!this[type] && s) this[type] = hs.createElement('div',
1953 { className: 'highslide-'+ type, innerHTML: s } );
1955 if (addOverlay && this[type]) {
1956 var o = { position: (type == 'heading') ? 'above' : 'below' };
1957 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
1958 o.overlayId = this[type];
1959 this.createOverlay(o);
1965 // on end move and resize
1966 doShowHide : function(visibility) {
1967 if (hs.hideSelects) this.showHideElements('SELECT', visibility);
1968 if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
1969 if (hs.geckoMac) this.showHideElements('*', visibility);
1971 showHideElements : function (tagName, visibility) {
1972 var els = document.getElementsByTagName(tagName);
1973 var prop = tagName == '*' ? 'overflow' : 'visibility';
1974 for (var i = 0; i < els.length; i++) {
1975 if (prop == 'visibility' || (document.defaultView.getComputedStyle(
1976 els[i], "").getPropertyValue('overflow') == 'auto'
1977 || els[i].getAttribute('hidden-by') != null)) {
1978 var hiddenBy = els[i].getAttribute('hidden-by');
1979 if (visibility == 'visible' && hiddenBy) {
1980 hiddenBy = hiddenBy.replace('['+ this.key +']', '');
1981 els[i].setAttribute('hidden-by', hiddenBy);
1982 if (!hiddenBy) els[i].style[prop] = els[i].origProp;
1983 } else if (visibility == 'hidden') { // hide if behind
1984 var elPos = hs.getPosition(els[i]);
1985 elPos.w = els[i].offsetWidth;
1986 elPos.h = els[i].offsetHeight;
1987 if (!this.dimmingOpacity) { // hide all if dimming
1989 var clearsX = (elPos.x + elPos.w < this.x.get('opos')
1990 || elPos.x > this.x.get('opos') + this.x.get('osize'));
1991 var clearsY = (elPos.y + elPos.h < this.y.get('opos')
1992 || elPos.y > this.y.get('opos') + this.y.get('osize'));
1994 var wrapperKey = hs.getWrapperKey(els[i]);
1995 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
1997 els[i].setAttribute('hidden-by', '['+ this.key +']');
1998 els[i].origProp = els[i].style[prop];
1999 els[i].style[prop] = 'hidden';
2001 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
2002 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
2004 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
2005 && wrapperKey != this.key) { // on move
2006 els[i].setAttribute('hidden-by', '');
2007 els[i].style[prop] = els[i].origProp || '';
2008 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
2009 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
2017 focus : function() {
2018 this.wrapper.style.zIndex = hs.zIndexCounter += 2;
2020 for (var i = 0; i < hs.expanders.length; i++) {
2021 if (hs.expanders[i] && i == hs.focusKey) {
2022 var blurExp = hs.expanders[i];
2023 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
2024 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer';
2025 blurExp.content.title = hs.lang.focusTitle;
2026 hs.fireEvent(blurExp, 'onBlur');
2031 if (this.outline) this.outline.table.style.zIndex
2032 = this.wrapper.style.zIndex - 1;
2033 this.content.className = 'highslide-'+ this.contentType;
2034 this.content.title = hs.lang.restoreTitle;
2036 if (hs.restoreCursor) {
2037 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
2038 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
2039 this.content.style.cursor = hs.styleRestoreCursor;
2042 hs.focusKey = this.key;
2043 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
2044 hs.fireEvent(this, 'onFocus');
2046 moveTo: function(x, y) {
2050 resize : function (e) {
2051 var w, h, r = e.width / e.height;
2052 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
2053 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
2055 if (h < Math.min(this.minHeight, this.y.full)) {
2056 h = Math.min(this.minHeight, this.y.full);
2057 if (this.isImage) w = h * r;
2059 this.resizeTo(w, h);
2061 resizeTo: function(w, h) {
2064 this.wrapper.style.height = this.y.get('wsize') +'px';
2067 close : function() {
2068 if (this.isClosing || !this.isExpanded) return;
2069 if (this.transitions[1] == 'crossfade' && hs.upcoming) {
2070 hs.getExpander(hs.upcoming).cancelLoading();
2073 if (!hs.fireEvent(this, 'onBeforeClose')) return;
2074 this.isClosing = true;
2075 if (this.slideshow && !hs.upcoming) this.slideshow.pause();
2077 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
2080 this.content.style.cursor = 'default';
2086 left: this.x.tpos - this.x.cb + this.x.tb,
2087 top: this.y.tpos - this.y.cb + this.y.tb
2095 }, hs.restoreDuration
2097 } catch (e) { this.afterClose(); }
2100 createOverlay : function (o) {
2101 var el = o.overlayId,
2102 relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position));
2103 if (typeof el == 'string') el = hs.getNode(el);
2104 if (o.html) el = hs.createElement('div', { innerHTML: o.html });
2105 if (!el || typeof el == 'string') return;
2106 if (!hs.fireEvent(this, 'onCreateOverlay', { overlay: el })) return;
2107 el.style.display = 'block';
2108 o.hsId = o.hsId || o.overlayId;
2109 if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return;
2110 this.genOverlayBox();
2111 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
2112 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
2113 var overlay = hs.createElement(
2115 id: 'hsId'+ hs.idCounter++,
2118 position: 'absolute',
2119 visibility: 'hidden',
2121 direction: hs.lang.cssDirection || '',
2124 relToVP ? hs.viewport :this.overlayBox,
2127 if (relToVP) overlay.hsKey = this.key;
2129 overlay.appendChild(el);
2130 hs.extend(overlay, {
2134 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
2136 hs.extend(overlay, o);
2139 if (this.gotOverlays) {
2140 this.positionOverlay(overlay);
2141 if (!overlay.hideOnMouseOut || this.mouseIsOver)
2142 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
2144 hs.push(this.overlays, hs.idCounter - 1);
2146 positionOverlay : function(overlay) {
2147 var p = overlay.position || 'middle center',
2148 relToVP = (overlay.relativeTo == 'viewport'),
2149 offX = overlay.offsetX,
2150 offY = overlay.offsetY;
2152 hs.viewport.style.display = 'block';
2153 overlay.hsKey = this.key;
2154 if (overlay.offsetWidth > overlay.parentNode.offsetWidth)
2155 overlay.style.width = '100%';
2157 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
2158 if (/left$/.test(p)) overlay.style.left = offX +'px';
2160 if (/center$/.test(p)) hs.setStyles (overlay, {
2162 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
2165 if (/right$/.test(p)) overlay.style.right = - offX +'px';
2167 if (/^leftpanel$/.test(p)) {
2168 hs.setStyles(overlay, {
2170 marginRight: this.x.cb +'px',
2171 top: - this.y.cb +'px',
2172 bottom: - this.y.cb +'px',
2175 this.x.p1 = overlay.offsetWidth;
2177 } else if (/^rightpanel$/.test(p)) {
2178 hs.setStyles(overlay, {
2180 marginLeft: this.x.cb +'px',
2181 top: - this.y.cb +'px',
2182 bottom: - this.y.cb +'px',
2185 this.x.p2 = overlay.offsetWidth;
2187 var parOff = overlay.parentNode.offsetHeight;
2188 overlay.style.height = 'auto';
2189 if (relToVP && overlay.offsetHeight > parOff)
2190 overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%';
2192 if (/^top/.test(p)) overlay.style.top = offY +'px';
2193 if (/^middle/.test(p)) hs.setStyles (overlay, {
2195 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
2197 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
2198 if (/^above$/.test(p)) {
2199 hs.setStyles(overlay, {
2200 left: (- this.x.p1 - this.x.cb) +'px',
2201 right: (- this.x.p2 - this.x.cb) +'px',
2203 marginBottom: this.y.cb +'px',
2206 this.y.p1 = overlay.offsetHeight;
2208 } else if (/^below$/.test(p)) {
2209 hs.setStyles(overlay, {
2210 position: 'relative',
2211 left: (- this.x.p1 - this.x.cb) +'px',
2212 right: (- this.x.p2 - this.x.cb) +'px',
2214 marginTop: this.y.cb +'px',
2217 this.y.p2 = overlay.offsetHeight;
2218 overlay.style.position = 'absolute';
2222 getOverlays : function() {
2223 this.getInline(['heading', 'caption'], true);
2225 if (this.caption) hs.fireEvent(this, 'onAfterGetCaption');
2226 if (this.heading) hs.fireEvent(this, 'onAfterGetHeading');
2227 if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
2228 if (hs.showCredits) this.writeCredits();
2229 for (var i = 0; i < hs.overlays.length; i++) {
2230 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
2231 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
2232 || (sg && sg === this.slideshowGroup)) {
2233 this.createOverlay(o);
2237 for (var i = 0; i < this.overlays.length; i++) {
2238 var o = hs.$('hsId'+ this.overlays[i]);
2239 if (/panel$/.test(o.position)) this.positionOverlay(o);
2240 else hs.push(os, o);
2242 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
2243 this.gotOverlays = true;
2245 genOverlayBox : function() {
2246 if (!this.overlayBox) this.overlayBox = hs.createElement (
2248 className: this.wrapperClassName
2250 position : 'absolute',
2251 width: (this.x.size || (this.useBox ? this.width : null)
2252 || this.x.full) +'px',
2253 height: (this.y.size || this.y.full) +'px',
2254 visibility : 'hidden',
2255 overflow : 'hidden',
2256 zIndex : hs.ie ? 4 : 'auto'
2262 sizeOverlayBox : function(doWrapper, doPanels) {
2263 var overlayBox = this.overlayBox,
2266 hs.setStyles( overlayBox, {
2267 width: x.size +'px',
2268 height: y.size +'px'
2270 if (doWrapper || doPanels) {
2271 for (var i = 0; i < this.overlays.length; i++) {
2272 var o = hs.$('hsId'+ this.overlays[i]);
2273 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
2274 if (o && /^(above|below)$/.test(o.position)) {
2276 o.style.width = (overlayBox.offsetWidth + 2 * x.cb
2277 + x.p1 + x.p2) +'px';
2279 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
2281 if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
2282 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
2287 hs.setStyles(this.content, {
2290 hs.setStyles(overlayBox, {
2291 top: (y.p1 + y.cb) +'px'
2296 showOverlays : function() {
2297 var b = this.overlayBox;
2300 top: (this.y.p1 + this.y.cb) +'px',
2301 left: (this.x.p1 + this.x.cb) +'px',
2302 overflow : 'visible'
2304 if (hs.safari) b.style.visibility = 'visible';
2305 this.wrapper.appendChild (b);
2306 for (var i = 0; i < this.overlays.length; i++) {
2307 var o = hs.$('hsId'+ this.overlays[i]);
2308 o.style.zIndex = o.zIndex || 4;
2309 if (!o.hideOnMouseOut || this.mouseIsOver) {
2310 o.style.visibility = 'visible';
2311 hs.setStyles(o, { visibility: 'visible', display: '' });
2312 hs.animate(o, { opacity: o.opacity }, o.dur);
2317 destroyOverlays : function() {
2318 if (!this.overlays.length) return;
2319 if (this.slideshow) {
2320 var c = this.slideshow.controls;
2321 if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c);
2323 for (var i = 0; i < this.overlays.length; i++) {
2324 var o = hs.$('hsId'+ this.overlays[i]);
2325 if (o && o.parentNode == hs.viewport && hs.getExpander(o) == this) hs.discardElement(o);
2327 hs.discardElement(this.overlayBox);
2332 createFullExpand : function () {
2333 if (this.slideshow && this.slideshow.controls) {
2334 this.slideshow.enable('full-expand');
2337 this.fullExpandLabel = hs.createElement(
2339 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
2340 title: hs.lang.fullExpandTitle,
2341 className: 'highslide-full-expand'
2344 if (!hs.fireEvent(this, 'onCreateFullExpand')) return;
2346 this.createOverlay({
2347 overlayId: this.fullExpandLabel,
2348 position: hs.fullExpandPosition,
2349 hideOnMouseOut: true,
2350 opacity: hs.fullExpandOpacity
2354 doFullExpand : function () {
2356 if (!hs.fireEvent(this, 'onDoFullExpand')) return;
2357 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
2360 var xSize = this.x.size,
2361 ySize = this.y.size;
2362 this.resizeTo(this.x.full, this.y.full);
2364 var xpos = this.x.pos - (this.x.size - xSize) / 2;
2365 if (xpos < hs.marginLeft) xpos = hs.marginLeft;
2367 var ypos = this.y.pos - (this.y.size - ySize) / 2;
2368 if (ypos < hs.marginTop) ypos = hs.marginTop;
2370 this.moveTo(xpos, ypos);
2371 this.doShowHide('hidden');
2379 afterClose : function () {
2380 this.a.className = this.a.className.replace('highslide-active-anchor', '');
2382 this.doShowHide('visible');
2383 if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
2385 hs.discardElement(this.wrapper);
2386 this.destroyOverlays();
2387 if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';
2389 if (this.dimmingOpacity) hs.undim(this.key);
2390 hs.fireEvent(this, 'onAfterClose');
2391 hs.expanders[this.key] = null;
2398 hs.Slideshow = function (expKey, options) {
2399 if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
2400 this.expKey = expKey;
2401 for (var x in options) this[x] = options[x];
2402 if (this.useControls) this.getControls();
2403 if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this);
2405 hs.Slideshow.prototype = {
2406 getControls: function() {
2407 this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) },
2408 null, hs.container);
2410 var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
2413 for (var i = 0; i < buttons.length; i++) {
2414 this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]);
2415 this.enable(buttons[i]);
2417 this.btn.pause.style.display = 'none';
2418 //this.disable('full-expand');
2420 checkFirstAndLast: function() {
2421 if (this.repeat || !this.controls) return;
2422 var exp = hs.expanders[this.expKey],
2423 cur = exp.getAnchorIndex(),
2426 this.disable('previous');
2427 else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
2428 this.enable('previous');
2429 if (cur + 1 == hs.anchors.groups[exp.slideshowGroup || 'none'].length) {
2430 this.disable('next');
2431 this.disable('play');
2432 } else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) {
2433 this.enable('next');
2434 this.enable('play');
2437 enable: function(btn) {
2438 if (!this.btn) return;
2439 var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/;
2440 a.onclick = function() {
2444 if (re.test(a.className)) a.className = a.className.replace(re, '');
2446 disable: function(btn) {
2447 if (!this.btn) return;
2448 var a = this.btn[btn].getElementsByTagName('a')[0];
2449 a.onclick = function() { return false; };
2450 if (!/disabled$/.test(a.className)) a.className += ' disabled';
2452 hitSpace: function() {
2453 if (this.autoplay) this.pause();
2456 play: function(wait) {
2458 this.btn.play.style.display = 'none';
2459 this.btn.pause.style.display = '';
2462 this.autoplay = true;
2463 if (!wait) hs.next(this.expKey);
2467 this.btn.pause.style.display = 'none';
2468 this.btn.play.style.display = '';
2471 clearTimeout(this.autoplay);
2472 this.autoplay = null;
2474 previous: function() {
2476 hs.previous(this.btn.previous);
2480 hs.next(this.btn.next);
2482 move: function() {},
2483 'full-expand': function() {
2484 hs.getExpander().doFullExpand();
2487 hs.close(this.btn.close);
2490 hs.Thumbstrip = function(slideshow) {
2491 function add (exp) {
2492 hs.extend(options || {}, {
2495 className: 'highslide-thumbstrip-'+ mode +'-overlay ' + (options.className || '')
2497 if (hs.ieLt7) options.fade = 0;
2498 exp.createOverlay(options);
2499 hs.setStyles(dom.parentNode, { overflow: 'hidden' });
2502 function scroll (delta) {
2503 selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
2506 function selectThumb (i, scrollBy) {
2507 if (i === undefined) for (var j = 0; j < group.length; j++) {
2508 if (group[j] == hs.expanders[slideshow.expKey].a) {
2513 if (i === undefined) return;
2514 var as = dom.getElementsByTagName('a'),
2516 cell = active.parentNode,
2517 left = isX ? 'Left' : 'Top',
2518 right = isX ? 'Right' : 'Bottom',
2519 width = isX ? 'Width' : 'Height',
2520 offsetLeft = 'offset' + left,
2521 offsetWidth = 'offset' + width,
2522 overlayWidth = div.parentNode.parentNode[offsetWidth],
2523 minTblPos = overlayWidth - table[offsetWidth],
2524 curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0,
2527 if (scrollBy !== undefined) {
2528 tblPos = curTblPos - scrollBy;
2530 if (minTblPos > 0) minTblPos = 0;
2531 if (tblPos > 0) tblPos = 0;
2532 if (tblPos < minTblPos) tblPos = minTblPos;
2536 for (var j = 0; j < as.length; j++) as[j].className = '';
2537 active.className = 'highslide-active-anchor';
2538 var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
2539 activeRight = cell[offsetLeft] + cell[offsetWidth] +
2540 (as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
2541 if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight;
2542 else if (activeLeft < -curTblPos) tblPos = -activeLeft;
2544 var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos;
2545 hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad');
2546 hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
2547 scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
2548 scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none';
2554 var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'],
2555 options = slideshow.thumbstrip,
2556 mode = options.mode || 'horizontal',
2557 floatMode = (mode == 'float'),
2558 tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'],
2559 isX = (mode == 'horizontal'),
2560 dom = hs.createElement('div', {
2561 className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode,
2563 '<div class="highslide-thumbstrip-inner">'+
2564 '<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+
2565 '<div class="highslide-scroll-up"><div></div></div>'+
2566 '<div class="highslide-scroll-down"><div></div></div>'+
2567 '<div class="highslide-marker"><div></div></div>'
2571 domCh = dom.childNodes,
2573 scrollUp = domCh[1],
2574 scrollDown = domCh[2],
2576 table = div.firstChild,
2577 tbody = dom.getElementsByTagName(tree[1])[0],
2579 for (var i = 0; i < group.length; i++) {
2580 if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody);
2583 cell = hs.createElement(tree[3], null, null, tr),
2585 hs.createElement('a', {
2588 onclick: function() {
2589 if (/highslide-active-anchor/.test(this.className)) return false;
2590 hs.getExpander(this).focus();
2591 return hs.transit(a);
2593 innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
2598 scrollUp.onclick = function () { scroll(-1); };
2599 scrollDown.onclick = function() { scroll(1); };
2600 hs.addEventListener(tbody, document.onmousewheel !== undefined ?
2601 'mousewheel' : 'DOMMouseScroll', function(e) {
2603 e = e || window.event;
2605 delta = e.wheelDelta/120;
2606 if (hs.opera) delta = -delta;
2607 } else if (e.detail) {
2608 delta = -e.detail/3;
2610 if (delta) scroll(-delta * 0.2);
2611 if (e.preventDefault) e.preventDefault();
2612 e.returnValue = false;
2618 selectThumb: selectThumb
2621 hs.langDefaults = hs.lang;
2623 var HsExpander = hs.Expander;
2624 if (hs.ie && window == window.top) {
2627 document.documentElement.doScroll('left');
2629 setTimeout(arguments.callee, 50);
2635 hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
2636 hs.addEventListener(window, 'load', hs.ready);
2639 hs.addEventListener(document, 'ready', function() {
2640 if (hs.expandCursor || hs.dimmingOpacity) {
2641 var style = hs.createElement('style', { type: 'text/css' }, null,
2642 document.getElementsByTagName('HEAD')[0]),
2643 backCompat = document.compatMode == 'BackCompat';
2646 function addRule(sel, dec) {
2647 if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
2648 var last = document.styleSheets[document.styleSheets.length - 1];
2649 if (typeof(last.addRule) == "object") last.addRule(sel, dec);
2651 style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
2654 function fix(prop) {
2655 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
2656 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
2658 if (hs.expandCursor) addRule ('.highslide img',
2659 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;');
2660 addRule ('.highslide-viewport-size',
2661 hs.ie && (hs.uaVersion < 7 || backCompat) ?
2662 'position: absolute; '+
2663 'left:'+ fix('scrollLeft') +
2664 'top:'+ fix('scrollTop') +
2665 'width:'+ fix('clientWidth') +
2666 'height:'+ fix('clientHeight') :
2667 'position: fixed; width: 100%; height: 100%; left: 0; top: 0');
2670 hs.addEventListener(window, 'resize', function() {
2672 if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) {
2673 var node = hs.viewport.childNodes[i],
2674 exp = hs.getExpander(node);
2675 exp.positionOverlay(node);
2676 if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb();
2679 hs.addEventListener(document, 'mousemove', function(e) {
2680 hs.mouse = { x: e.clientX, y: e.clientY };
2682 hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
2683 hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
2685 hs.addEventListener(document, 'ready', hs.getAnchors);
2686 hs.addEventListener(window, 'load', hs.preloadImages);