3 * Version: 4.1.13 (2011-10-06)
4 * Config: default +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() {
372 visibility: 'visible',
374 }, hs.container, true);
376 if (/(Android|iPad|iPhone|iPod)/.test(navigator.userAgent)) {
377 var body = document.body;
378 function pixDimmerSize() {
379 hs.setStyles(hs.dimmer, {
380 width: body.scrollWidth +'px',
381 height: body.scrollHeight +'px'
385 hs.addEventListener(window, 'resize', pixDimmerSize);
388 hs.dimmer.style.display = '';
390 var isNew = hs.dimmer.owner == '';
391 hs.dimmer.owner += '|'+ exp.key;
394 if (hs.geckoMac && hs.dimmingGeckoFix)
395 hs.setStyles(hs.dimmer, {
396 background: 'url('+ hs.graphicsDir + 'geckodimmer.png)',
400 hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration);
403 undim : function(key) {
404 if (!hs.dimmer) return;
405 if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, '');
408 (typeof key != 'undefined' && hs.dimmer.owner != '')
409 || (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
412 if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none';
413 else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() {
414 hs.dimmer.style.display = 'none';
417 transit : function (adj, exp) {
418 var last = exp || hs.getExpander();
420 if (hs.upcoming) return false;
422 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
427 hs.last = hs.upcoming = null;
430 if (!adj || exp.transitions[1] != 'crossfade')
436 previousOrNext : function (el, op) {
437 var exp = hs.getExpander(el);
438 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp);
442 previous : function (el) {
443 return hs.previousOrNext(el, -1);
446 next : function (el) {
447 return hs.previousOrNext(el, 1);
450 keyHandler : function(e) {
451 if (!e) e = window.event;
452 if (!e.target) e.target = e.srcElement; // ie
453 if (typeof e.target.form != 'undefined') return true; // form element has focus
454 var exp = hs.getExpander();
459 if (exp) exp.doFullExpand();
464 case 34: // Page Down
465 case 39: // Arrow right
466 case 40: // Arrow down
471 case 37: // Arrow left
479 if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
480 if (!hs.enableKeyListener) return true;
482 if (e.preventDefault) e.preventDefault();
483 else e.returnValue = false;
487 } else if (op == 2) {
488 if (exp.slideshow) exp.slideshow.hitSpace();
490 if (exp.slideshow) exp.slideshow.pause();
491 hs.previousOrNext(exp.key, op);
500 registerOverlay : function (overlay) {
501 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } ));
505 addSlideshow : function (options) {
506 var sg = options.slideshowGroup;
507 if (typeof sg == 'object') {
508 for (var i = 0; i < sg.length; i++) {
510 for (var x in options) o[x] = options[x];
511 o.slideshowGroup = sg[i];
512 hs.push(hs.slideshows, o);
515 hs.push(hs.slideshows, options);
519 getWrapperKey : function (element, expOnly) {
520 var el, re = /^highslide-wrapper-([0-9]+)$/;
521 // 1. look in open expanders
523 while (el.parentNode) {
524 if (el.hsKey !== undefined) return el.hsKey;
525 if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
528 // 2. look in thumbnail
531 while (el.parentNode) {
532 if (el.tagName && hs.isHsAnchor(el)) {
533 for (var key = 0; key < hs.expanders.length; key++) {
534 var exp = hs.expanders[key];
535 if (exp && exp.a == el) return key;
544 getExpander : function (el, expOnly) {
545 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
546 if (typeof el == 'number') return hs.expanders[el] || null;
547 if (typeof el == 'string') el = hs.$(el);
548 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
551 isHsAnchor : function (a) {
552 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
555 reOrder : function () {
556 for (var i = 0; i < hs.expanders.length; i++)
557 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
560 mouseClickHandler : function(e)
562 if (!e) e = window.event;
563 if (e.button > 1) return true;
564 if (!e.target) e.target = e.srcElement;
568 && !(/highslide-(image|move|html|resize)/.test(el.className)))
572 var exp = hs.getExpander(el);
573 if (exp && (exp.isClosing || !exp.isExpanded)) return true;
575 if (exp && e.type == 'mousedown') {
576 if (e.target.form) return true;
577 var match = el.className.match(/highslide-(image|move|resize)/);
591 hs.addEventListener(document, 'mousemove', hs.dragHandler);
592 if (e.preventDefault) e.preventDefault(); // FF
594 if (/highslide-(image|html)-blur/.test(exp.content.className)) {
596 hs.hasFocused = true;
600 } else if (e.type == 'mouseup') {
602 hs.removeEventListener(document, 'mousemove', hs.dragHandler);
605 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image')
606 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
607 var hasDragged = hs.dragArgs.hasDragged;
609 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
612 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
613 hs.dragArgs.exp.doShowHide('hidden');
615 hs.hasFocused = false;
618 } else if (/highslide-image-blur/.test(el.className)) {
619 el.style.cursor = hs.styleRestoreCursor;
625 dragHandler : function(e)
627 if (!hs.dragArgs) return true;
628 if (!e) e = window.event;
629 var a = hs.dragArgs, exp = a.exp;
631 a.dX = e.clientX - a.clickX;
632 a.dY = e.clientY - a.clickY;
634 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
635 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
636 || (distance > (hs.dragSensitivity || 5));
638 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
640 if (a.type == 'resize') exp.resize(a);
642 exp.moveTo(a.left + a.dX, a.top + a.dY);
643 if (a.type == 'image') exp.content.style.cursor = 'move';
649 wrapperMouseHandler : function (e) {
651 if (!e) e = window.event;
652 var over = /mouseover/i.test(e.type);
653 if (!e.target) e.target = e.srcElement; // ie
654 if (!e.relatedTarget) e.relatedTarget =
655 over ? e.fromElement : e.toElement; // ie
656 var exp = hs.getExpander(e.target);
657 if (!exp.isExpanded) return;
658 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp
659 || hs.dragArgs) return;
660 for (var i = 0; i < exp.overlays.length; i++) (function() {
661 var o = hs.$('hsId'+ exp.overlays[i]);
662 if (o && o.hideOnMouseOut) {
663 if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
664 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
669 addEventListener : function (el, event, func) {
670 if (el == document && event == 'ready') {
671 hs.push(hs.onReady, func);
674 el.addEventListener(event, func, false);
677 el.detachEvent('on'+ event, func);
678 el.attachEvent('on'+ event, func);
680 el['on'+ event] = func;
685 removeEventListener : function (el, event, func) {
687 el.removeEventListener(event, func, false);
690 el.detachEvent('on'+ event, func);
692 el['on'+ event] = null;
697 preloadFullImage : function (i) {
698 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
699 var img = document.createElement('img');
700 img.onload = function() {
702 hs.preloadFullImage(i + 1);
704 img.src = hs.preloadTheseImages[i];
707 preloadImages : function (number) {
708 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
710 var arr = hs.getAnchors();
711 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
712 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
716 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
719 hs.preloadFullImage(0);
722 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
729 hs.ieLt7 = hs.ie && hs.uaVersion < 7;
730 hs.ieLt9 = hs.ie && hs.uaVersion < 9;
733 for (var x in hs.langDefaults) {
734 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
735 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined')
736 hs.lang[x] = hs.langDefaults[x];
739 hs.container = hs.createElement('div', {
740 className: 'highslide-container'
742 position: 'absolute',
746 zIndex: hs.zIndexCounter,
752 hs.loading = hs.createElement('a', {
753 className: 'highslide-loading',
754 title: hs.lang.loadingTitle,
755 innerHTML: hs.lang.loadingText,
758 position: 'absolute',
760 opacity: hs.loadingOpacity,
764 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
765 hs.viewport = hs.createElement('div', {
766 className: 'highslide-viewport highslide-viewport-size'
768 visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden'
772 // http://www.robertpenner.com/easing/
773 Math.linearTween = function (t, b, c, d) {
776 Math.easeInQuad = function (t, b, c, d) {
777 return c*(t/=d)*t + b;
779 Math.easeOutQuad = function (t, b, c, d) {
780 return -c *(t/=d)*(t-2) + b;
783 hs.hideSelects = hs.ieLt7;
784 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE'
785 || (hs.ieLt7 && hs.uaVersion < 5.5));
789 if (hs.isReady) return;
791 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
794 updateAnchors : function() {
795 var el, els, all = [], images = [],groups = {}, re;
797 for (var i = 0; i < hs.openerTagNames.length; i++) {
798 els = document.getElementsByTagName(hs.openerTagNames[i]);
799 for (var j = 0; j < els.length; j++) {
801 re = hs.isHsAnchor(el);
804 if (re[0] == 'hs.expand') hs.push(images, el);
805 var g = hs.getParam(el, 'slideshowGroup') || 'none';
806 if (!groups[g]) groups[g] = [];
807 hs.push(groups[g], el);
811 hs.anchors = { all: all, groups: groups, images: images };
816 getAnchors : function() {
817 return hs.anchors || hs.updateAnchors();
821 close : function(el) {
822 var exp = hs.getExpander(el);
823 if (exp) exp.close();
827 hs.fx = function( elem, options, prop ){
828 this.options = options;
832 if (!options.orig) options.orig = {};
836 (hs.fx.step[this.prop] || hs.fx.step._default)(this);
838 if (this.options.step)
839 this.options.step.call(this.elem, this.now, this);
842 custom: function(from, to, unit){
843 this.startTime = (new Date()).getTime();
846 this.unit = unit;// || this.unit || "px";
847 this.now = this.start;
848 this.pos = this.state = 0;
852 return self.step(gotoEnd);
857 if ( t() && hs.timers.push(t) == 1 ) {
858 hs.timerId = setInterval(function(){
859 var timers = hs.timers;
861 for ( var i = 0; i < timers.length; i++ )
863 timers.splice(i--, 1);
865 if ( !timers.length ) {
866 clearInterval(hs.timerId);
871 step: function(gotoEnd){
872 var t = (new Date()).getTime();
873 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
875 this.pos = this.state = 1;
878 this.options.curAnim[ this.prop ] = true;
881 for ( var i in this.options.curAnim )
882 if ( this.options.curAnim[i] !== true )
886 if (this.options.complete) this.options.complete.call(this.elem);
890 var n = t - this.startTime;
891 this.state = n / this.options.duration;
892 this.pos = this.options.easing(n, 0, 1, this.options.duration);
893 this.now = this.start + ((this.end - this.start) * this.pos);
904 opacity: function(fx){
905 hs.setStyles(fx.elem, { opacity: fx.now });
908 _default: function(fx){
910 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
911 fx.elem.style[ fx.prop ] = fx.now + fx.unit;
913 fx.elem[ fx.prop ] = fx.now;
919 hs.Outline = function (outlineType, onLoad) {
920 this.onLoad = onLoad;
921 this.outlineType = outlineType;
922 var v = hs.uaVersion, tr;
924 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
926 if (onLoad) onLoad();
931 this.table = hs.createElement(
935 visibility: 'hidden',
936 position: 'absolute',
937 borderCollapse: 'collapse',
943 var tbody = hs.createElement('tbody', null, null, this.table, 1);
946 for (var i = 0; i <= 8; i++) {
947 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
948 this.td[i] = hs.createElement('td', null, null, tr, true);
949 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
950 hs.setStyles(this.td[i], style);
952 this.td[4].className = outlineType +' highslide-outline';
954 this.preloadGraphic();
957 hs.Outline.prototype = {
958 preloadGraphic : function () {
959 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
961 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
962 this.graphic = hs.createElement('img', null, { position: 'absolute',
963 top: '-9999px' }, appendTo, true); // for onload trigger
966 this.graphic.onload = function() { pThis.onGraphicLoad(); };
968 this.graphic.src = src;
971 onGraphicLoad : function () {
972 var o = this.offset = this.graphic.width / 4,
973 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
974 dim = { height: (2*o) +'px', width: (2*o) +'px' };
975 for (var i = 0; i <= 8; i++) {
977 if (this.hasAlphaImageLoader) {
978 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
979 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
980 hs.createElement ('div', null, {
981 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
982 position: 'absolute',
984 height: this.graphic.height +'px',
985 left: (pos[i][0]*o)+'px',
986 top: (pos[i][1]*o)+'px'
991 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
994 if (window.opera && (i == 3 || i ==5))
995 hs.createElement('div', null, dim, this.td[i], true);
997 hs.setStyles (this.td[i], dim);
1000 this.graphic = null;
1001 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
1002 hs.pendingOutlines[this.outlineType] = this;
1003 if (this.onLoad) this.onLoad();
1006 setPosition : function (pos, offset, vis, dur, easing) {
1008 stl = exp.wrapper.style,
1009 offset = offset || 0,
1011 x: exp.x.pos + offset,
1012 y: exp.y.pos + offset,
1013 w: exp.x.get('wsize') - 2 * offset,
1014 h: exp.y.get('wsize') - 2 * offset
1016 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
1017 ? 'visible' : 'hidden';
1018 hs.setStyles(this.table, {
1019 left: (pos.x - this.offset) +'px',
1020 top: (pos.y - this.offset) +'px',
1021 width: (pos.w + 2 * this.offset) +'px'
1024 pos.w -= 2 * this.offset;
1025 pos.h -= 2 * this.offset;
1026 hs.setStyles (this.td[4], {
1027 width: pos.w >= 0 ? pos.w +'px' : 0,
1028 height: pos.h >= 0 ? pos.h +'px' : 0
1030 if (this.hasAlphaImageLoader) this.td[3].style.height
1031 = this.td[5].style.height = this.td[4].style.height;
1035 destroy : function(hide) {
1036 if (hide) this.table.style.visibility = 'hidden';
1037 else hs.discardElement(this.table);
1041 hs.Dimension = function(exp, dim) {
1044 this.ucwh = dim == 'x' ? 'Width' : 'Height';
1045 this.wh = this.ucwh.toLowerCase();
1046 this.uclt = dim == 'x' ? 'Left' : 'Top';
1047 this.lt = this.uclt.toLowerCase();
1048 this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
1049 this.rb = this.ucrb.toLowerCase();
1050 this.p1 = this.p2 = 0;
1052 hs.Dimension.prototype = {
1053 get : function(key) {
1056 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
1057 case 'loadingPosXfade':
1058 return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2;
1060 return this.size + 2 * this.cb + this.p1 + this.p2;
1062 return this.clientSize - this.marginMin - this.marginMax;
1064 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
1066 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
1068 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
1070 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
1074 calcBorders: function() {
1075 // correct for borders
1076 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
1078 this.marginMax = hs['margin'+ this.ucrb];
1080 calcThumb: function() {
1081 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) :
1082 this.exp.el['offset'+ this.ucwh];
1083 this.tpos = this.exp.tpos[this.dim];
1084 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
1085 if (this.tpos == 0 || this.tpos == -1) {
1086 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];
1089 calcExpanded: function() {
1091 this.justify = 'auto';
1094 if (exp.align == 'center') this.justify = 'center';
1095 else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null;
1096 else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max';
1099 // size and position
1100 this.pos = this.tpos - this.cb + this.tb;
1102 if (this.maxHeight && this.dim == 'x')
1103 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full);
1105 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
1106 this.minSize = exp.allowSizeReduction ?
1107 Math.min(exp['min'+ this.ucwh], this.full) :this.full;
1108 if (exp.isImage && exp.useBox) {
1109 this.size = exp[this.wh];
1110 this.imgSize = this.full;
1112 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
1113 this.target = exp['target'+ this.dim.toUpperCase()];
1114 this.marginMin = hs['margin'+ this.uclt];
1115 this.scroll = hs.page['scroll'+ this.uclt];
1116 this.clientSize = hs.page[this.wh];
1118 setSize: function(i) {
1120 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
1122 this.size = Math.max(this.size, this.imgSize);
1123 exp.content.style[this.lt] = this.get('imgPad')+'px';
1127 exp.content.style[this.wh] = i +'px';
1128 exp.wrapper.style[this.wh] = this.get('wsize') +'px';
1129 if (exp.outline) exp.outline.setPosition();
1130 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
1131 if (this.dim == 'x' && exp.slideshow && exp.isImage) {
1132 if (i == this.full) exp.slideshow.disable('full-expand');
1133 else exp.slideshow.enable('full-expand');
1136 setPos: function(i) {
1138 this.exp.wrapper.style[this.lt] = i +'px';
1140 if (this.exp.outline) this.exp.outline.setPosition();
1145 hs.Expander = function(a, params, custom, contentType) {
1146 if (document.readyState && hs.ie && !hs.isReady) {
1147 hs.addEventListener(document, 'ready', function() {
1148 new hs.Expander(a, params, custom, contentType);
1153 this.custom = custom;
1154 this.contentType = contentType || 'image';
1155 this.isImage = !this.isHtml;
1157 hs.continuePreloading = false;
1159 this.last = hs.last;
1162 var key = this.key = hs.expanders.length;
1163 // override inline parameters
1164 for (var i = 0; i < hs.overrides.length; i++) {
1165 var name = hs.overrides[i];
1166 this[name] = params && typeof params[name] != 'undefined' ?
1167 params[name] : hs[name];
1169 if (!this.src) this.src = a.href;
1172 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
1173 el = this.thumb = el.getElementsByTagName('img')[0] || el;
1174 this.thumbsUserSetId = el.id || a.id;
1176 // check if already open
1177 for (var i = 0; i < hs.expanders.length; i++) {
1178 if (hs.expanders[i] && hs.expanders[i].a == a
1179 && !(this.last && this.transitions[1] == 'crossfade')) {
1180 hs.expanders[i].focus();
1186 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
1187 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
1188 hs.expanders[i].cancelLoading();
1191 hs.expanders[key] = this;
1192 if (!hs.allowMultipleInstances && !hs.upcoming) {
1193 if (hs.expanders[key-1]) hs.expanders[key-1].close();
1194 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
1195 hs.expanders[hs.focusKey].close();
1200 this.tpos = this.pageOrigin || hs.getPosition(el);
1202 var x = this.x = new hs.Dimension(this, 'x');
1204 var y = this.y = new hs.Dimension(this, 'y');
1206 this.wrapper = hs.createElement(
1208 id: 'highslide-wrapper-'+ this.key,
1209 className: 'highslide-wrapper '+ this.wrapperClassName
1211 visibility: 'hidden',
1212 position: 'absolute',
1213 zIndex: hs.zIndexCounter += 2
1216 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
1217 if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
1218 this.outlineWhileAnimating = 0;
1221 if (!this.outlineType
1222 || (this.last && this.isImage && this.transitions[1] == 'crossfade')) {
1223 this[this.contentType +'Create']();
1225 } else if (hs.pendingOutlines[this.outlineType]) {
1226 this.connectOutline();
1227 this[this.contentType +'Create']();
1232 new hs.Outline(this.outlineType,
1234 exp.connectOutline();
1235 exp[exp.contentType +'Create']();
1242 hs.Expander.prototype = {
1243 error : function(e) {
1244 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message);
1245 else window.location.href = this.src;
1248 connectOutline : function() {
1249 var outline = this.outline = hs.pendingOutlines[this.outlineType];
1251 outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
1252 hs.pendingOutlines[this.outlineType] = null;
1255 showLoading : function() {
1256 if (this.onLoadStarted || this.loading) return;
1258 this.loading = hs.loading;
1260 this.loading.onclick = function() {
1261 exp.cancelLoading();
1264 l = this.x.get('loadingPos') +'px',
1265 t = this.y.get('loadingPos') +'px';
1266 if (!tgt && this.last && this.transitions[1] == 'crossfade')
1267 var tgt = this.last;
1269 l = tgt.x.get('loadingPosXfade') +'px';
1270 t = tgt.y.get('loadingPosXfade') +'px';
1271 this.loading.style.zIndex = hs.zIndexCounter++;
1273 setTimeout(function () {
1274 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
1278 imageCreate : function() {
1281 var img = document.createElement('img');
1283 img.onload = function () {
1284 if (hs.expanders[exp.key]) exp.contentLoaded();
1286 if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
1287 img.className = 'highslide-image';
1289 visibility: 'hidden',
1291 position: 'absolute',
1295 img.title = hs.lang.restoreTitle;
1296 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
1297 if (hs.ie && hs.flushImgSize) img.src = null;
1303 contentLoaded : function() {
1305 if (!this.content) return;
1306 this.content.onload = null;
1307 if (this.onLoadStarted) return;
1308 else this.onLoadStarted = true;
1310 var x = this.x, y = this.y;
1313 hs.setStyles(this.loading, { top: '-9999px' });
1314 this.loading = null;
1316 x.full = this.content.width;
1317 y.full = this.content.height;
1319 hs.setStyles(this.content, {
1323 this.wrapper.appendChild(this.content);
1324 hs.container.appendChild(this.wrapper);
1329 hs.setStyles (this.wrapper, {
1330 left: (x.tpos + x.tb - x.cb) +'px',
1331 top: (y.tpos + x.tb - y.cb) +'px'
1335 this.initSlideshow();
1338 var ratio = x.full / y.full;
1344 if (this.overlayBox) this.sizeOverlayBox(0, 1);
1347 if (this.allowSizeReduction) {
1348 this.correctRatio(ratio);
1349 var ss = this.slideshow;
1350 if (ss && this.last && ss.controls && ss.fixedControls) {
1351 var pos = ss.overlayOptions.position || '', p;
1352 for (var dim in hs.oPos) for (var i = 0; i < 5; i++) {
1354 if (pos.match(hs.oPos[dim][i])) {
1355 p.pos = this.last[dim].pos
1356 + (this.last[dim].p1 - p.p1)
1357 + (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i];
1358 if (ss.fixedControls == 'fit') {
1359 if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
1360 p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2;
1361 if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin;
1366 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
1367 this.createFullExpand();
1368 if (this.overlays.length == 1) this.sizeOverlayBox();
1378 justify : function (p, moveOnly) {
1379 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
1381 if (tgt && tgt.match(/ /)) {
1382 tgtArr = tgt.split(' ');
1385 if (tgt && hs.$(tgt)) {
1386 p.pos = hs.getPosition(hs.$(tgt))[dim];
1387 if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/))
1388 p.pos += parseInt(tgtArr[1]);
1389 if (p.size < p.minSize) p.size = p.minSize;
1391 } else if (p.justify == 'auto' || p.justify == 'center') {
1393 var hasMovedMin = false;
1395 var allowReduce = p.exp.allowSizeReduction;
1396 if (p.justify == 'center')
1397 p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2);
1399 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
1400 if (p.pos < p.scroll + p.marginMin) {
1401 p.pos = p.scroll + p.marginMin;
1404 if (!moveOnly && p.size < p.minSize) {
1406 allowReduce = false;
1408 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
1409 if (!moveOnly && hasMovedMin && allowReduce) {
1410 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize'));
1411 } else if (p.get('wsize') < p.get('fitsize')) {
1412 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
1413 } else { // image larger than viewport
1414 p.pos = p.scroll + p.marginMin;
1415 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
1419 if (!moveOnly && p.size < p.minSize) {
1421 allowReduce = false;
1425 } else if (p.justify == 'max') {
1426 p.pos = Math.floor(p.pos - p.size + p.t);
1430 if (p.pos < p.marginMin) {
1432 p.pos = p.marginMin;
1434 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
1439 correctRatio : function(ratio) {
1443 xSize = Math.min(x.full, x.size),
1444 ySize = Math.min(y.full, y.size),
1445 useBox = (this.useBox || hs.padToMinWidth);
1447 if (xSize / ySize > ratio) { // width greater
1448 xSize = ySize * ratio;
1449 if (xSize < x.minSize) { // below minWidth
1451 ySize = xSize / ratio;
1455 } else if (xSize / ySize < ratio) { // height greater
1456 ySize = xSize / ratio;
1460 if (hs.padToMinWidth && x.full < x.minSize) {
1462 y.size = y.imgSize = y.full;
1463 } else if (this.useBox) {
1470 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed);
1471 if (useBox && y.size < y.imgSize) {
1473 x.imgSize = y.size * ratio;
1475 if (changed || useBox) {
1476 x.pos = x.tpos - x.cb + x.tb;
1478 this.justify(x, true);
1480 y.pos = y.tpos - y.cb + y.tb;
1482 this.justify(y, true);
1483 if (this.overlayBox) this.sizeOverlayBox();
1488 fitOverlayBox : function(ratio, changed) {
1489 var x = this.x, y = this.y;
1490 if (this.overlayBox) {
1491 while (y.size > this.minHeight && x.size > this.minWidth
1492 && y.get('wsize') > y.get('fitsize')) {
1494 if (ratio) x.size = y.size * ratio;
1495 this.sizeOverlayBox(0, 1);
1502 show : function () {
1503 var x = this.x, y = this.y;
1504 this.doShowHide('hidden');
1505 if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb();
1507 // Apply size change
1511 width : x.get('wsize'),
1512 height : y.get('wsize'),
1517 left: x.p1 + x.get('imgPad'),
1518 top: y.p1 + y.get('imgPad'),
1519 width:x.imgSize ||x.size,
1520 height:y.imgSize ||y.size
1527 changeSize : function(up, to, dur) {
1529 var trans = this.transitions,
1530 other = up ? (this.last ? this.last.a : null) : hs.upcoming,
1531 t = (trans[1] && other
1532 && hs.getParam(other, 'transitions')[1] == trans[1]) ?
1533 trans[1] : trans[0];
1535 if (this[t] && t != 'expand') {
1540 if (this.outline && !this.outlineWhileAnimating) {
1541 if (up) this.outline.setPosition();
1542 else this.outline.destroy();
1546 if (!up) this.destroyOverlays();
1551 easing = this.easing;
1552 if (!up) easing = this.easingClose || easing;
1556 if (exp.outline) exp.outline.table.style.visibility = "visible";
1557 setTimeout(function() {
1564 if (up) hs.setStyles( this.wrapper, {
1568 if (this.fadeInOut) {
1569 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
1570 hs.extend(to.wrapper, { opacity: up });
1572 hs.animate( this.wrapper, to.wrapper, {
1575 step: function(val, args) {
1576 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
1577 var fac = up ? args.pos : 1 - args.pos;
1579 w: x.t + (x.get('wsize') - x.t) * fac,
1580 h: y.t + (y.get('wsize') - y.t) * fac,
1581 x: x.tpos + (x.pos - x.tpos) * fac,
1582 y: y.tpos + (y.pos - y.tpos) * fac
1584 exp.outline.setPosition(pos, 0, 1);
1588 hs.animate( this.content, to.content, dur, easing, after);
1590 this.wrapper.style.visibility = 'visible';
1591 this.content.style.visibility = 'visible';
1592 this.a.className += ' highslide-active-anchor';
1598 fade : function(up, to) {
1599 this.outlineWhileAnimating = false;
1600 var exp = this, t = up ? hs.expandDuration : 0;
1603 hs.animate(this.wrapper, to.wrapper, 0);
1604 hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' });
1605 hs.animate(this.content, to.content, 0);
1606 this.content.style.visibility = 'visible';
1608 hs.animate(this.wrapper, { opacity: 1 }, t, null,
1609 function() { exp.afterExpand(); });
1613 this.outline.table.style.zIndex = this.wrapper.style.zIndex;
1615 offset = this.outline.offset,
1616 startOff = up ? 3 : offset,
1617 endOff = up? offset : 3;
1618 for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) {
1620 var o = up ? endOff - i : startOff - i;
1621 setTimeout(function() {
1622 exp.outline.setPosition(0, o, 1);
1629 if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50);
1631 setTimeout( function() {
1632 if (exp.outline) exp.outline.destroy(exp.preserveContent);
1634 exp.destroyOverlays();
1636 hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){
1642 crossfade : function (up, to, from) {
1650 wrapper = this.wrapper,
1651 content = this.content,
1652 overlayBox = this.overlayBox;
1653 hs.removeEventListener(document, 'mousemove', hs.dragHandler);
1655 hs.setStyles(content, {
1656 width: (x.imgSize || x.size) +'px',
1657 height: (y.imgSize || y.size) +'px'
1659 if (overlayBox) overlayBox.style.overflow = 'visible';
1660 this.outline = last.outline;
1661 if (this.outline) this.outline.exp = exp;
1662 last.outline = null;
1663 var fadeBox = hs.createElement('div', {
1664 className: 'highslide-'+ this.contentType
1666 position: 'absolute',
1672 var names = { oldImg: last, newImg: this };
1673 for (var n in names) {
1674 this[n] = names[n].content.cloneNode(1);
1675 hs.setStyles(this[n], {
1676 position: 'absolute',
1678 visibility: 'visible'
1680 fadeBox.appendChild(this[n]);
1682 wrapper.appendChild(fadeBox);
1684 overlayBox.className = '';
1685 wrapper.appendChild(overlayBox);
1687 fadeBox.style.display = '';
1688 last.content.style.display = 'none';
1691 if (hs.safari && hs.uaVersion < 525) {
1692 this.wrapper.style.visibility = 'visible';
1694 hs.animate(wrapper, {
1697 duration: hs.transitionDuration,
1698 step: function(val, args) {
1703 props = ['pos', 'size', 'p1', 'p2'];
1704 for (var n in props) {
1706 size['x'+ prop] = Math.round(invPos * lastX[prop] + pos * x[prop]);
1707 size['y'+ prop] = Math.round(invPos * lastY[prop] + pos * y[prop]);
1708 size.ximgSize = Math.round(
1709 invPos * (lastX.imgSize || lastX.size) + pos * (x.imgSize || x.size));
1710 size.ximgPad = Math.round(invPos * lastX.get('imgPad') + pos * x.get('imgPad'));
1711 size.yimgSize = Math.round(
1712 invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size));
1713 size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad'));
1715 if (exp.outline) exp.outline.setPosition({
1718 w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb,
1719 h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb
1721 last.wrapper.style.clip = 'rect('
1722 + (size.ypos - lastY.pos)+'px, '
1723 + (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, '
1724 + (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, '
1725 + (size.xpos - lastX.pos)+'px)';
1727 hs.setStyles(content, {
1728 top: (size.yp1 + y.get('imgPad')) +'px',
1729 left: (size.xp1 + x.get('imgPad')) +'px',
1730 marginTop: (y.pos - size.ypos) +'px',
1731 marginLeft: (x.pos - size.xpos) +'px'
1733 hs.setStyles(wrapper, {
1734 top: size.ypos +'px',
1735 left: size.xpos +'px',
1736 width: (size.xp1 + size.xp2 + size.xsize + 2 * x.cb)+ 'px',
1737 height: (size.yp1 + size.yp2 + size.ysize + 2 * y.cb) + 'px'
1739 hs.setStyles(fadeBox, {
1740 width: (size.ximgSize || size.xsize) + 'px',
1741 height: (size.yimgSize || size.ysize) +'px',
1742 left: (size.xp1 + size.ximgPad) +'px',
1743 top: (size.yp1 + size.yimgPad) +'px',
1744 visibility: 'visible'
1747 hs.setStyles(exp.oldImg, {
1748 top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px',
1749 left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px'
1752 hs.setStyles(exp.newImg, {
1754 top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px',
1755 left: (x.pos - size.xpos + x.p1 - size.xp1 + x.get('imgPad') - size.ximgPad) +'px'
1757 if (overlayBox) hs.setStyles(overlayBox, {
1758 width: size.xsize + 'px',
1759 height: size.ysize +'px',
1760 left: (size.xp1 + x.cb) +'px',
1761 top: (size.yp1 + y.cb) +'px'
1764 complete: function () {
1765 wrapper.style.visibility = content.style.visibility = 'visible';
1766 content.style.display = 'block';
1767 hs.discardElement(fadeBox);
1775 reuseOverlay : function(o, el) {
1776 if (!this.last) return false;
1777 for (var i = 0; i < this.last.overlays.length; i++) {
1778 var oDiv = hs.$('hsId'+ this.last.overlays[i]);
1779 if (oDiv && oDiv.hsId == o.hsId) {
1780 this.genOverlayBox();
1781 oDiv.reuse = this.key;
1782 hs.push(this.overlays, this.last.overlays[i]);
1790 afterExpand : function() {
1791 this.isExpanded = true;
1793 if (this.dimmingOpacity) hs.dim(this);
1794 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
1795 this.prepareNextOutline();
1796 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
1797 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
1798 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
1799 if (this.overlayBox) this.showOverlays();
1804 prepareNextOutline : function() {
1806 var outlineType = this.outlineType;
1807 new hs.Outline(outlineType,
1808 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
1812 preloadNext : function() {
1813 var next = this.getAdjacentAnchor(1);
1814 if (next && next.onclick.toString().match(/hs\.expand/))
1815 var img = hs.createElement('img', { src: hs.getSrc(next) });
1819 getAdjacentAnchor : function(op) {
1820 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];
1821 if (as && !as[current + op] && this.slideshow && this.slideshow.repeat) {
1822 if (op == 1) return as[0];
1823 else if (op == -1) return as[as.length-1];
1825 return (as && as[current + op]) || null;
1828 getAnchorIndex : function() {
1829 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
1830 if (arr) for (var i = 0; i < arr.length; i++) {
1831 if (arr[i] == this.a) return i;
1837 getNumber : function() {
1838 if (this[this.numberPosition]) {
1839 var arr = hs.anchors.groups[this.slideshowGroup || 'none'];
1841 var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length);
1842 this[this.numberPosition].innerHTML =
1843 '<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML;
1847 initSlideshow : function() {
1849 for (var i = 0; i < hs.slideshows.length; i++) {
1850 var ss = hs.slideshows[i], sg = ss.slideshowGroup;
1851 if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup)
1852 this.slideshow = new hs.Slideshow(this.key, ss);
1855 this.slideshow = this.last.slideshow;
1857 var ss = this.slideshow;
1859 var key = ss.expKey = this.key;
1861 ss.checkFirstAndLast();
1862 ss.disable('full-expand');
1864 this.createOverlay(hs.extend(ss.overlayOptions || {}, {
1865 overlayId: ss.controls,
1870 if (ss.thumbstrip) ss.thumbstrip.add(this);
1871 if (!this.last && this.autoplay) ss.play(true);
1873 ss.autoplay = setTimeout(function() {
1875 }, (ss.interval || 500));
1879 cancelLoading : function() {
1880 hs.discardElement (this.wrapper);
1881 hs.expanders[this.key] = null;
1882 if (hs.upcoming == this.a) hs.upcoming = null;
1884 if (this.loading) hs.loading.style.left = '-9999px';
1887 writeCredits : function () {
1888 if (this.credits) return;
1889 this.credits = hs.createElement('a', {
1890 href: hs.creditsHref,
1891 target: hs.creditsTarget,
1892 className: 'highslide-credits',
1893 innerHTML: hs.lang.creditsText,
1894 title: hs.lang.creditsTitle
1896 this.createOverlay({
1897 overlayId: this.credits,
1898 position: this.creditsPosition || 'top left',
1903 getInline : function(types, addOverlay) {
1904 for (var i = 0; i < types.length; i++) {
1905 var type = types[i], s = null;
1906 if (!this[type +'Id'] && this.thumbsUserSetId)
1907 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
1908 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
1909 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
1910 s = eval(this[type +'Eval']);
1912 if (!this[type] && this[type +'Text']) {
1913 s = this[type +'Text'];
1915 if (!this[type] && !s) {
1916 this[type] = hs.getNode(this.a['_'+ type + 'Id']);
1918 var next = this.a.nextSibling;
1919 while (next && !hs.isHsAnchor(next)) {
1920 if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
1921 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++;
1922 this[type] = hs.getNode(next.id);
1925 next = next.nextSibling;
1929 if (!this[type] && !s && this.numberPosition == type) s = '\n';
1931 if (!this[type] && s) this[type] = hs.createElement('div',
1932 { className: 'highslide-'+ type, innerHTML: s } );
1934 if (addOverlay && this[type]) {
1935 var o = { position: (type == 'heading') ? 'above' : 'below' };
1936 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
1937 o.overlayId = this[type];
1938 this.createOverlay(o);
1944 // on end move and resize
1945 doShowHide : function(visibility) {
1946 if (hs.hideSelects) this.showHideElements('SELECT', visibility);
1947 if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
1948 if (hs.geckoMac) this.showHideElements('*', visibility);
1950 showHideElements : function (tagName, visibility) {
1951 var els = document.getElementsByTagName(tagName);
1952 var prop = tagName == '*' ? 'overflow' : 'visibility';
1953 for (var i = 0; i < els.length; i++) {
1954 if (prop == 'visibility' || (document.defaultView.getComputedStyle(
1955 els[i], "").getPropertyValue('overflow') == 'auto'
1956 || els[i].getAttribute('hidden-by') != null)) {
1957 var hiddenBy = els[i].getAttribute('hidden-by');
1958 if (visibility == 'visible' && hiddenBy) {
1959 hiddenBy = hiddenBy.replace('['+ this.key +']', '');
1960 els[i].setAttribute('hidden-by', hiddenBy);
1961 if (!hiddenBy) els[i].style[prop] = els[i].origProp;
1962 } else if (visibility == 'hidden') { // hide if behind
1963 var elPos = hs.getPosition(els[i]);
1964 elPos.w = els[i].offsetWidth;
1965 elPos.h = els[i].offsetHeight;
1966 if (!this.dimmingOpacity) { // hide all if dimming
1968 var clearsX = (elPos.x + elPos.w < this.x.get('opos')
1969 || elPos.x > this.x.get('opos') + this.x.get('osize'));
1970 var clearsY = (elPos.y + elPos.h < this.y.get('opos')
1971 || elPos.y > this.y.get('opos') + this.y.get('osize'));
1973 var wrapperKey = hs.getWrapperKey(els[i]);
1974 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
1976 els[i].setAttribute('hidden-by', '['+ this.key +']');
1977 els[i].origProp = els[i].style[prop];
1978 els[i].style[prop] = 'hidden';
1980 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
1981 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
1983 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
1984 && wrapperKey != this.key) { // on move
1985 els[i].setAttribute('hidden-by', '');
1986 els[i].style[prop] = els[i].origProp || '';
1987 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
1988 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
1996 focus : function() {
1997 this.wrapper.style.zIndex = hs.zIndexCounter += 2;
1999 for (var i = 0; i < hs.expanders.length; i++) {
2000 if (hs.expanders[i] && i == hs.focusKey) {
2001 var blurExp = hs.expanders[i];
2002 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
2003 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer';
2004 blurExp.content.title = hs.lang.focusTitle;
2009 if (this.outline) this.outline.table.style.zIndex
2010 = this.wrapper.style.zIndex - 1;
2011 this.content.className = 'highslide-'+ this.contentType;
2012 this.content.title = hs.lang.restoreTitle;
2014 if (hs.restoreCursor) {
2015 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
2016 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
2017 this.content.style.cursor = hs.styleRestoreCursor;
2020 hs.focusKey = this.key;
2021 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
2023 moveTo: function(x, y) {
2027 resize : function (e) {
2028 var w, h, r = e.width / e.height;
2029 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
2030 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
2032 if (h < Math.min(this.minHeight, this.y.full)) {
2033 h = Math.min(this.minHeight, this.y.full);
2034 if (this.isImage) w = h * r;
2036 this.resizeTo(w, h);
2038 resizeTo: function(w, h) {
2041 this.wrapper.style.height = this.y.get('wsize') +'px';
2044 close : function() {
2045 if (this.isClosing || !this.isExpanded) return;
2046 if (this.transitions[1] == 'crossfade' && hs.upcoming) {
2047 hs.getExpander(hs.upcoming).cancelLoading();
2050 this.isClosing = true;
2051 if (this.slideshow && !hs.upcoming) this.slideshow.pause();
2053 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
2056 this.content.style.cursor = 'default';
2062 left: this.x.tpos - this.x.cb + this.x.tb,
2063 top: this.y.tpos - this.y.cb + this.y.tb
2071 }, hs.restoreDuration
2073 } catch (e) { this.afterClose(); }
2076 createOverlay : function (o) {
2077 var el = o.overlayId,
2078 relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position));
2079 if (typeof el == 'string') el = hs.getNode(el);
2080 if (o.html) el = hs.createElement('div', { innerHTML: o.html });
2081 if (!el || typeof el == 'string') return;
2082 el.style.display = 'block';
2083 o.hsId = o.hsId || o.overlayId;
2084 if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return;
2085 this.genOverlayBox();
2086 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
2087 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
2088 var overlay = hs.createElement(
2090 id: 'hsId'+ hs.idCounter++,
2093 position: 'absolute',
2094 visibility: 'hidden',
2096 direction: hs.lang.cssDirection || '',
2099 relToVP ? hs.viewport :this.overlayBox,
2102 if (relToVP) overlay.hsKey = this.key;
2104 overlay.appendChild(el);
2105 hs.extend(overlay, {
2109 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
2111 hs.extend(overlay, o);
2114 if (this.gotOverlays) {
2115 this.positionOverlay(overlay);
2116 if (!overlay.hideOnMouseOut || this.mouseIsOver)
2117 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
2119 hs.push(this.overlays, hs.idCounter - 1);
2121 positionOverlay : function(overlay) {
2122 var p = overlay.position || 'middle center',
2123 relToVP = (overlay.relativeTo == 'viewport'),
2124 offX = overlay.offsetX,
2125 offY = overlay.offsetY;
2127 hs.viewport.style.display = 'block';
2128 overlay.hsKey = this.key;
2129 if (overlay.offsetWidth > overlay.parentNode.offsetWidth)
2130 overlay.style.width = '100%';
2132 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
2133 if (/left$/.test(p)) overlay.style.left = offX +'px';
2135 if (/center$/.test(p)) hs.setStyles (overlay, {
2137 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
2140 if (/right$/.test(p)) overlay.style.right = - offX +'px';
2142 if (/^leftpanel$/.test(p)) {
2143 hs.setStyles(overlay, {
2145 marginRight: this.x.cb +'px',
2146 top: - this.y.cb +'px',
2147 bottom: - this.y.cb +'px',
2150 this.x.p1 = overlay.offsetWidth;
2152 } else if (/^rightpanel$/.test(p)) {
2153 hs.setStyles(overlay, {
2155 marginLeft: this.x.cb +'px',
2156 top: - this.y.cb +'px',
2157 bottom: - this.y.cb +'px',
2160 this.x.p2 = overlay.offsetWidth;
2162 var parOff = overlay.parentNode.offsetHeight;
2163 overlay.style.height = 'auto';
2164 if (relToVP && overlay.offsetHeight > parOff)
2165 overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%';
2167 if (/^top/.test(p)) overlay.style.top = offY +'px';
2168 if (/^middle/.test(p)) hs.setStyles (overlay, {
2170 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
2172 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
2173 if (/^above$/.test(p)) {
2174 hs.setStyles(overlay, {
2175 left: (- this.x.p1 - this.x.cb) +'px',
2176 right: (- this.x.p2 - this.x.cb) +'px',
2178 marginBottom: this.y.cb +'px',
2181 this.y.p1 = overlay.offsetHeight;
2183 } else if (/^below$/.test(p)) {
2184 hs.setStyles(overlay, {
2185 position: 'relative',
2186 left: (- this.x.p1 - this.x.cb) +'px',
2187 right: (- this.x.p2 - this.x.cb) +'px',
2189 marginTop: this.y.cb +'px',
2192 this.y.p2 = overlay.offsetHeight;
2193 overlay.style.position = 'absolute';
2197 getOverlays : function() {
2198 this.getInline(['heading', 'caption'], true);
2200 if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
2201 if (hs.showCredits) this.writeCredits();
2202 for (var i = 0; i < hs.overlays.length; i++) {
2203 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
2204 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
2205 || (sg && sg === this.slideshowGroup)) {
2206 this.createOverlay(o);
2210 for (var i = 0; i < this.overlays.length; i++) {
2211 var o = hs.$('hsId'+ this.overlays[i]);
2212 if (/panel$/.test(o.position)) this.positionOverlay(o);
2213 else hs.push(os, o);
2215 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
2216 this.gotOverlays = true;
2218 genOverlayBox : function() {
2219 if (!this.overlayBox) this.overlayBox = hs.createElement (
2221 className: this.wrapperClassName
2223 position : 'absolute',
2224 width: (this.x.size || (this.useBox ? this.width : null)
2225 || this.x.full) +'px',
2226 height: (this.y.size || this.y.full) +'px',
2227 visibility : 'hidden',
2228 overflow : 'hidden',
2229 zIndex : hs.ie ? 4 : 'auto'
2235 sizeOverlayBox : function(doWrapper, doPanels) {
2236 var overlayBox = this.overlayBox,
2239 hs.setStyles( overlayBox, {
2240 width: x.size +'px',
2241 height: y.size +'px'
2243 if (doWrapper || doPanels) {
2244 for (var i = 0; i < this.overlays.length; i++) {
2245 var o = hs.$('hsId'+ this.overlays[i]);
2246 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
2247 if (o && /^(above|below)$/.test(o.position)) {
2249 o.style.width = (overlayBox.offsetWidth + 2 * x.cb
2250 + x.p1 + x.p2) +'px';
2252 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
2254 if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
2255 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
2260 hs.setStyles(this.content, {
2263 hs.setStyles(overlayBox, {
2264 top: (y.p1 + y.cb) +'px'
2269 showOverlays : function() {
2270 var b = this.overlayBox;
2273 top: (this.y.p1 + this.y.cb) +'px',
2274 left: (this.x.p1 + this.x.cb) +'px',
2275 overflow : 'visible'
2277 if (hs.safari) b.style.visibility = 'visible';
2278 this.wrapper.appendChild (b);
2279 for (var i = 0; i < this.overlays.length; i++) {
2280 var o = hs.$('hsId'+ this.overlays[i]);
2281 o.style.zIndex = o.zIndex || 4;
2282 if (!o.hideOnMouseOut || this.mouseIsOver) {
2283 o.style.visibility = 'visible';
2284 hs.setStyles(o, { visibility: 'visible', display: '' });
2285 hs.animate(o, { opacity: o.opacity }, o.dur);
2290 destroyOverlays : function() {
2291 if (!this.overlays.length) return;
2292 if (this.slideshow) {
2293 var c = this.slideshow.controls;
2294 if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c);
2296 for (var i = 0; i < this.overlays.length; i++) {
2297 var o = hs.$('hsId'+ this.overlays[i]);
2298 if (o && o.parentNode == hs.viewport && hs.getExpander(o) == this) hs.discardElement(o);
2300 hs.discardElement(this.overlayBox);
2305 createFullExpand : function () {
2306 if (this.slideshow && this.slideshow.controls) {
2307 this.slideshow.enable('full-expand');
2310 this.fullExpandLabel = hs.createElement(
2312 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
2313 title: hs.lang.fullExpandTitle,
2314 className: 'highslide-full-expand'
2318 this.createOverlay({
2319 overlayId: this.fullExpandLabel,
2320 position: hs.fullExpandPosition,
2321 hideOnMouseOut: true,
2322 opacity: hs.fullExpandOpacity
2326 doFullExpand : function () {
2328 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
2331 var xSize = this.x.size,
2332 ySize = this.y.size;
2333 this.resizeTo(this.x.full, this.y.full);
2335 var xpos = this.x.pos - (this.x.size - xSize) / 2;
2336 if (xpos < hs.marginLeft) xpos = hs.marginLeft;
2338 var ypos = this.y.pos - (this.y.size - ySize) / 2;
2339 if (ypos < hs.marginTop) ypos = hs.marginTop;
2341 this.moveTo(xpos, ypos);
2342 this.doShowHide('hidden');
2350 afterClose : function () {
2351 this.a.className = this.a.className.replace('highslide-active-anchor', '');
2353 this.doShowHide('visible');
2354 if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
2356 hs.discardElement(this.wrapper);
2357 this.destroyOverlays();
2358 if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';
2360 if (this.dimmingOpacity) hs.undim(this.key);
2361 hs.expanders[this.key] = null;
2368 hs.Slideshow = function (expKey, options) {
2369 if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
2370 this.expKey = expKey;
2371 for (var x in options) this[x] = options[x];
2372 if (this.useControls) this.getControls();
2373 if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this);
2375 hs.Slideshow.prototype = {
2376 getControls: function() {
2377 this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) },
2378 null, hs.container);
2380 var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
2383 for (var i = 0; i < buttons.length; i++) {
2384 this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]);
2385 this.enable(buttons[i]);
2387 this.btn.pause.style.display = 'none';
2388 //this.disable('full-expand');
2390 checkFirstAndLast: function() {
2391 if (this.repeat || !this.controls) return;
2392 var exp = hs.expanders[this.expKey],
2393 cur = exp.getAnchorIndex(),
2396 this.disable('previous');
2397 else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
2398 this.enable('previous');
2399 if (cur + 1 == hs.anchors.groups[exp.slideshowGroup || 'none'].length) {
2400 this.disable('next');
2401 this.disable('play');
2402 } else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) {
2403 this.enable('next');
2404 this.enable('play');
2407 enable: function(btn) {
2408 if (!this.btn) return;
2409 var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/;
2410 a.onclick = function() {
2414 if (re.test(a.className)) a.className = a.className.replace(re, '');
2416 disable: function(btn) {
2417 if (!this.btn) return;
2418 var a = this.btn[btn].getElementsByTagName('a')[0];
2419 a.onclick = function() { return false; };
2420 if (!/disabled$/.test(a.className)) a.className += ' disabled';
2422 hitSpace: function() {
2423 if (this.autoplay) this.pause();
2426 play: function(wait) {
2428 this.btn.play.style.display = 'none';
2429 this.btn.pause.style.display = '';
2432 this.autoplay = true;
2433 if (!wait) hs.next(this.expKey);
2437 this.btn.pause.style.display = 'none';
2438 this.btn.play.style.display = '';
2441 clearTimeout(this.autoplay);
2442 this.autoplay = null;
2444 previous: function() {
2446 hs.previous(this.btn.previous);
2450 hs.next(this.btn.next);
2452 move: function() {},
2453 'full-expand': function() {
2454 hs.getExpander().doFullExpand();
2457 hs.close(this.btn.close);
2460 hs.Thumbstrip = function(slideshow) {
2461 function add (exp) {
2462 hs.extend(options || {}, {
2465 className: 'highslide-thumbstrip-'+ mode +'-overlay ' + (options.className || '')
2467 if (hs.ieLt7) options.fade = 0;
2468 exp.createOverlay(options);
2469 hs.setStyles(dom.parentNode, { overflow: 'hidden' });
2472 function scroll (delta) {
2473 selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
2476 function selectThumb (i, scrollBy) {
2477 if (i === undefined) for (var j = 0; j < group.length; j++) {
2478 if (group[j] == hs.expanders[slideshow.expKey].a) {
2483 if (i === undefined) return;
2484 var as = dom.getElementsByTagName('a'),
2486 cell = active.parentNode,
2487 left = isX ? 'Left' : 'Top',
2488 right = isX ? 'Right' : 'Bottom',
2489 width = isX ? 'Width' : 'Height',
2490 offsetLeft = 'offset' + left,
2491 offsetWidth = 'offset' + width,
2492 overlayWidth = div.parentNode.parentNode[offsetWidth],
2493 minTblPos = overlayWidth - table[offsetWidth],
2494 curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0,
2497 if (scrollBy !== undefined) {
2498 tblPos = curTblPos - scrollBy;
2500 if (minTblPos > 0) minTblPos = 0;
2501 if (tblPos > 0) tblPos = 0;
2502 if (tblPos < minTblPos) tblPos = minTblPos;
2506 for (var j = 0; j < as.length; j++) as[j].className = '';
2507 active.className = 'highslide-active-anchor';
2508 var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
2509 activeRight = cell[offsetLeft] + cell[offsetWidth] +
2510 (as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
2511 if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight;
2512 else if (activeLeft < -curTblPos) tblPos = -activeLeft;
2514 var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos;
2515 hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad');
2516 hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
2517 scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
2518 scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none';
2524 var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'],
2525 options = slideshow.thumbstrip,
2526 mode = options.mode || 'horizontal',
2527 floatMode = (mode == 'float'),
2528 tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'],
2529 isX = (mode == 'horizontal'),
2530 dom = hs.createElement('div', {
2531 className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode,
2533 '<div class="highslide-thumbstrip-inner">'+
2534 '<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+
2535 '<div class="highslide-scroll-up"><div></div></div>'+
2536 '<div class="highslide-scroll-down"><div></div></div>'+
2537 '<div class="highslide-marker"><div></div></div>'
2541 domCh = dom.childNodes,
2543 scrollUp = domCh[1],
2544 scrollDown = domCh[2],
2546 table = div.firstChild,
2547 tbody = dom.getElementsByTagName(tree[1])[0],
2549 for (var i = 0; i < group.length; i++) {
2550 if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody);
2553 cell = hs.createElement(tree[3], null, null, tr),
2555 hs.createElement('a', {
2558 onclick: function() {
2559 if (/highslide-active-anchor/.test(this.className)) return false;
2560 hs.getExpander(this).focus();
2561 return hs.transit(a);
2563 innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
2568 scrollUp.onclick = function () { scroll(-1); };
2569 scrollDown.onclick = function() { scroll(1); };
2570 hs.addEventListener(tbody, document.onmousewheel !== undefined ?
2571 'mousewheel' : 'DOMMouseScroll', function(e) {
2573 e = e || window.event;
2575 delta = e.wheelDelta/120;
2576 if (hs.opera) delta = -delta;
2577 } else if (e.detail) {
2578 delta = -e.detail/3;
2580 if (delta) scroll(-delta * 0.2);
2581 if (e.preventDefault) e.preventDefault();
2582 e.returnValue = false;
2588 selectThumb: selectThumb
2591 hs.langDefaults = hs.lang;
2593 var HsExpander = hs.Expander;
2594 if (hs.ie && window == window.top) {
2597 document.documentElement.doScroll('left');
2599 setTimeout(arguments.callee, 50);
2605 hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
2606 hs.addEventListener(window, 'load', hs.ready);
2609 hs.addEventListener(document, 'ready', function() {
2610 if (hs.expandCursor || hs.dimmingOpacity) {
2611 var style = hs.createElement('style', { type: 'text/css' }, null,
2612 document.getElementsByTagName('HEAD')[0]),
2613 backCompat = document.compatMode == 'BackCompat';
2616 function addRule(sel, dec) {
2617 if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
2618 var last = document.styleSheets[document.styleSheets.length - 1];
2619 if (typeof(last.addRule) == "object") last.addRule(sel, dec);
2621 style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
2624 function fix(prop) {
2625 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
2626 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
2628 if (hs.expandCursor) addRule ('.highslide img',
2629 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;');
2630 addRule ('.highslide-viewport-size',
2631 hs.ie && (hs.uaVersion < 7 || backCompat) ?
2632 'position: absolute; '+
2633 'left:'+ fix('scrollLeft') +
2634 'top:'+ fix('scrollTop') +
2635 'width:'+ fix('clientWidth') +
2636 'height:'+ fix('clientHeight') :
2637 'position: fixed; width: 100%; height: 100%; left: 0; top: 0');
2640 hs.addEventListener(window, 'resize', function() {
2642 if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) {
2643 var node = hs.viewport.childNodes[i],
2644 exp = hs.getExpander(node);
2645 exp.positionOverlay(node);
2646 if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb();
2649 hs.addEventListener(document, 'mousemove', function(e) {
2650 hs.mouse = { x: e.clientX, y: e.clientY };
2652 hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
2653 hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
2655 hs.addEventListener(document, 'ready', hs.getAnchors);
2656 hs.addEventListener(window, 'load', hs.preloadImages);