3 * Version: 4.1.13 (2011-10-06)
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 restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
21 // See http://highslide.com/ref for examples of settings
22 graphicsDir : 'highslide/graphics/',
23 expandCursor : 'zoomin.cur', // null disables
24 restoreCursor : 'zoomout.cur', // null disables
25 expandDuration : 250, // milliseconds
26 restoreDuration : 250,
31 zIndexCounter : 1001, // adjust to other absolutely positioned elements
32 loadingOpacity : 0.75,
33 allowMultipleInstances: true,
34 numberOfImagesToPreload : 5,
35 outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only
36 outlineStartOffset : 3, // ends at 10
37 padToMinWidth : false, // pad the popup width to make room for wide caption
38 fullExpandPosition : 'bottom right',
39 fullExpandOpacity : 1,
40 showCredits : true, // you can set this to false if you want
41 creditsHref : 'http://highslide.com/',
42 creditsTarget : '_self',
43 enableKeyListener : true,
44 openerTagNames : ['a'], // Add more to allow slideshow indexing
49 allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight
50 outlineType : 'drop-shadow', // set null to disable outlines
51 // END OF YOUR SETTINGS
54 // declare internal properties
55 preloadTheseImages : [],
56 continuePreloading: true,
62 'outlineWhileAnimating',
92 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
93 y: ['above', 'top', 'middle', 'bottom', 'below']
100 pendingOutlines : {},
103 uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 :
104 parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]),
105 ie : (document.all && !window.opera),
106 //ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant?
107 safari : /Safari/.test(navigator.userAgent),
108 geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
111 if (id) return document.getElementById(id);
114 push : function (arr, val) {
115 arr[arr.length] = val;
118 createElement : function (tag, attribs, styles, parent, nopad) {
119 var el = document.createElement(tag);
120 if (attribs) hs.extend(el, attribs);
121 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
122 if (styles) hs.setStyles(el, styles);
123 if (parent) parent.appendChild(el);
127 extend : function (el, attribs) {
128 for (var x in attribs) el[x] = attribs[x];
132 setStyles : function (el, styles) {
133 for (var x in styles) {
134 if (hs.ieLt9 && x == 'opacity') {
135 if (styles[x] > 0.99) el.style.removeAttribute('filter');
136 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
138 else el.style[x] = styles[x];
141 animate: function(el, prop, opt) {
145 if (typeof opt != 'object' || opt === null) {
146 var args = arguments;
153 if (typeof opt.duration != 'number') opt.duration = 250;
154 opt.easing = Math[opt.easing] || Math.easeInQuad;
155 opt.curAnim = hs.extend({}, prop);
156 for (var name in prop) {
157 var e = new hs.fx(el, opt , name );
159 start = parseFloat(hs.css(el, name)) || 0;
160 end = parseFloat(prop[name]);
161 unit = name != 'opacity' ? 'px' : '';
163 e.custom( start, end, unit );
166 css: function(el, prop) {
167 if (el.style[prop]) {
168 return el.style[prop];
169 } else if (document.defaultView) {
170 return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);
173 if (prop == 'opacity') prop = 'filter';
174 var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
175 if (prop == 'filter')
176 val = val.replace(/alpha\(opacity=([0-9]+)\)/,
177 function (a, b) { return b / 100 });
178 return val === '' ? 1 : val;
182 getPageSize : function () {
183 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat'
184 ? d.documentElement : d.body,
185 ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined');
187 var width = ieLt9 ? iebody.clientWidth :
188 (d.documentElement.clientWidth || self.innerWidth),
189 height = ieLt9 ? iebody.clientHeight : self.innerHeight;
193 scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset,
194 scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset
199 getPosition : function(el) {
200 var p = { x: el.offsetLeft, y: el.offsetTop };
201 while (el.offsetParent) {
202 el = el.offsetParent;
203 p.x += el.offsetLeft;
205 if (el != document.body && el != document.documentElement) {
206 p.x -= el.scrollLeft;
213 expand : function(a, params, custom, type) {
214 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
215 if (typeof a.getParams == 'function') return params;
217 new hs.Expander(a, params, custom);
219 } catch (e) { return true; }
223 focusTopmost : function() {
226 expanders = hs.expanders,
229 for (var i = 0; i < expanders.length; i++) {
232 zIndex = exp.wrapper.style.zIndex;
233 if (zIndex && zIndex > topZ) {
239 if (topmostKey == -1) hs.focusKey = -1;
240 else expanders[topmostKey].focus();
243 getParam : function (a, param) {
244 a.getParams = a.onclick;
245 var p = a.getParams ? a.getParams() : null;
248 return (p && typeof p[param] != 'undefined') ? p[param] :
249 (typeof hs[param] != 'undefined' ? hs[param] : null);
252 getSrc : function (a) {
253 var src = hs.getParam(a, 'src');
258 getNode : function (id) {
259 var node = hs.$(id), clone = hs.clones[id], a = {};
260 if (!node && !clone) return null;
262 clone = node.cloneNode(true);
264 hs.clones[id] = clone;
267 return clone.cloneNode(true);
271 discardElement : function(d) {
272 if (d) hs.garbageBin.appendChild(d);
273 hs.garbageBin.innerHTML = '';
275 transit : function (adj, exp) {
276 var last = exp || hs.getExpander();
278 if (hs.upcoming) return false;
280 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
285 hs.last = hs.upcoming = null;
293 previousOrNext : function (el, op) {
294 var exp = hs.getExpander(el);
295 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp);
299 previous : function (el) {
300 return hs.previousOrNext(el, -1);
303 next : function (el) {
304 return hs.previousOrNext(el, 1);
307 keyHandler : function(e) {
308 if (!e) e = window.event;
309 if (!e.target) e.target = e.srcElement; // ie
310 if (typeof e.target.form != 'undefined') return true; // form element has focus
311 var exp = hs.getExpander();
316 if (exp) exp.doFullExpand();
319 case 34: // Page Down
320 case 39: // Arrow right
321 case 40: // Arrow down
326 case 37: // Arrow left
334 if (op !== null) {hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
335 if (!hs.enableKeyListener) return true;
337 if (e.preventDefault) e.preventDefault();
338 else e.returnValue = false;
343 hs.previousOrNext(exp.key, op);
352 registerOverlay : function (overlay) {
353 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } ));
357 getWrapperKey : function (element, expOnly) {
358 var el, re = /^highslide-wrapper-([0-9]+)$/;
359 // 1. look in open expanders
361 while (el.parentNode) {
362 if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
365 // 2. look in thumbnail
368 while (el.parentNode) {
369 if (el.tagName && hs.isHsAnchor(el)) {
370 for (var key = 0; key < hs.expanders.length; key++) {
371 var exp = hs.expanders[key];
372 if (exp && exp.a == el) return key;
381 getExpander : function (el, expOnly) {
382 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
383 if (typeof el == 'number') return hs.expanders[el] || null;
384 if (typeof el == 'string') el = hs.$(el);
385 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
388 isHsAnchor : function (a) {
389 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
392 reOrder : function () {
393 for (var i = 0; i < hs.expanders.length; i++)
394 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
397 mouseClickHandler : function(e)
399 if (!e) e = window.event;
400 if (e.button > 1) return true;
401 if (!e.target) e.target = e.srcElement;
405 && !(/highslide-(image|move|html|resize)/.test(el.className)))
409 var exp = hs.getExpander(el);
410 if (exp && (exp.isClosing || !exp.isExpanded)) return true;
412 if (exp && e.type == 'mousedown') {
413 if (e.target.form) return true;
414 var match = el.className.match(/highslide-(image|move|resize)/);
428 hs.addEventListener(document, 'mousemove', hs.dragHandler);
429 if (e.preventDefault) e.preventDefault(); // FF
431 if (/highslide-(image|html)-blur/.test(exp.content.className)) {
433 hs.hasFocused = true;
437 } else if (e.type == 'mouseup') {
439 hs.removeEventListener(document, 'mousemove', hs.dragHandler);
442 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image')
443 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
444 var hasDragged = hs.dragArgs.hasDragged;
446 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
449 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
450 hs.dragArgs.exp.doShowHide('hidden');
452 hs.hasFocused = false;
455 } else if (/highslide-image-blur/.test(el.className)) {
456 el.style.cursor = hs.styleRestoreCursor;
462 dragHandler : function(e)
464 if (!hs.dragArgs) return true;
465 if (!e) e = window.event;
466 var a = hs.dragArgs, exp = a.exp;
468 a.dX = e.clientX - a.clickX;
469 a.dY = e.clientY - a.clickY;
471 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
472 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
473 || (distance > (hs.dragSensitivity || 5));
475 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
477 if (a.type == 'resize') exp.resize(a);
479 exp.moveTo(a.left + a.dX, a.top + a.dY);
480 if (a.type == 'image') exp.content.style.cursor = 'move';
486 wrapperMouseHandler : function (e) {
488 if (!e) e = window.event;
489 var over = /mouseover/i.test(e.type);
490 if (!e.target) e.target = e.srcElement; // ie
491 if (!e.relatedTarget) e.relatedTarget =
492 over ? e.fromElement : e.toElement; // ie
493 var exp = hs.getExpander(e.target);
494 if (!exp.isExpanded) return;
495 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp
496 || hs.dragArgs) return;
497 for (var i = 0; i < exp.overlays.length; i++) (function() {
498 var o = hs.$('hsId'+ exp.overlays[i]);
499 if (o && o.hideOnMouseOut) {
500 if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
501 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
506 addEventListener : function (el, event, func) {
507 if (el == document && event == 'ready') {
508 hs.push(hs.onReady, func);
511 el.addEventListener(event, func, false);
514 el.detachEvent('on'+ event, func);
515 el.attachEvent('on'+ event, func);
517 el['on'+ event] = func;
522 removeEventListener : function (el, event, func) {
524 el.removeEventListener(event, func, false);
527 el.detachEvent('on'+ event, func);
529 el['on'+ event] = null;
534 preloadFullImage : function (i) {
535 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
536 var img = document.createElement('img');
537 img.onload = function() {
539 hs.preloadFullImage(i + 1);
541 img.src = hs.preloadTheseImages[i];
544 preloadImages : function (number) {
545 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
547 var arr = hs.getAnchors();
548 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
549 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
553 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
556 hs.preloadFullImage(0);
559 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
566 hs.ieLt7 = hs.ie && hs.uaVersion < 7;
567 hs.ieLt9 = hs.ie && hs.uaVersion < 9;
570 for (var x in hs.langDefaults) {
571 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
572 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined')
573 hs.lang[x] = hs.langDefaults[x];
576 hs.container = hs.createElement('div', {
577 className: 'highslide-container'
579 position: 'absolute',
583 zIndex: hs.zIndexCounter,
589 hs.loading = hs.createElement('a', {
590 className: 'highslide-loading',
591 title: hs.lang.loadingTitle,
592 innerHTML: hs.lang.loadingText,
595 position: 'absolute',
597 opacity: hs.loadingOpacity,
601 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
603 // http://www.robertpenner.com/easing/
604 Math.linearTween = function (t, b, c, d) {
607 Math.easeInQuad = function (t, b, c, d) {
608 return c*(t/=d)*t + b;
611 hs.hideSelects = hs.ieLt7;
612 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE'
613 || (hs.ieLt7 && hs.uaVersion < 5.5));
617 if (hs.isReady) return;
619 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
622 updateAnchors : function() {
623 var el, els, all = [], images = [],groups = {}, re;
625 for (var i = 0; i < hs.openerTagNames.length; i++) {
626 els = document.getElementsByTagName(hs.openerTagNames[i]);
627 for (var j = 0; j < els.length; j++) {
629 re = hs.isHsAnchor(el);
632 if (re[0] == 'hs.expand') hs.push(images, el);
633 var g = hs.getParam(el, 'slideshowGroup') || 'none';
634 if (!groups[g]) groups[g] = [];
635 hs.push(groups[g], el);
639 hs.anchors = { all: all, groups: groups, images: images };
644 getAnchors : function() {
645 return hs.anchors || hs.updateAnchors();
649 close : function(el) {
650 var exp = hs.getExpander(el);
651 if (exp) exp.close();
655 hs.fx = function( elem, options, prop ){
656 this.options = options;
660 if (!options.orig) options.orig = {};
664 (hs.fx.step[this.prop] || hs.fx.step._default)(this);
666 if (this.options.step)
667 this.options.step.call(this.elem, this.now, this);
670 custom: function(from, to, unit){
671 this.startTime = (new Date()).getTime();
674 this.unit = unit;// || this.unit || "px";
675 this.now = this.start;
676 this.pos = this.state = 0;
680 return self.step(gotoEnd);
685 if ( t() && hs.timers.push(t) == 1 ) {
686 hs.timerId = setInterval(function(){
687 var timers = hs.timers;
689 for ( var i = 0; i < timers.length; i++ )
691 timers.splice(i--, 1);
693 if ( !timers.length ) {
694 clearInterval(hs.timerId);
699 step: function(gotoEnd){
700 var t = (new Date()).getTime();
701 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
703 this.pos = this.state = 1;
706 this.options.curAnim[ this.prop ] = true;
709 for ( var i in this.options.curAnim )
710 if ( this.options.curAnim[i] !== true )
714 if (this.options.complete) this.options.complete.call(this.elem);
718 var n = t - this.startTime;
719 this.state = n / this.options.duration;
720 this.pos = this.options.easing(n, 0, 1, this.options.duration);
721 this.now = this.start + ((this.end - this.start) * this.pos);
732 opacity: function(fx){
733 hs.setStyles(fx.elem, { opacity: fx.now });
736 _default: function(fx){
738 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
739 fx.elem.style[ fx.prop ] = fx.now + fx.unit;
741 fx.elem[ fx.prop ] = fx.now;
747 hs.Outline = function (outlineType, onLoad) {
748 this.onLoad = onLoad;
749 this.outlineType = outlineType;
750 var v = hs.uaVersion, tr;
752 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
754 if (onLoad) onLoad();
759 this.table = hs.createElement(
763 visibility: 'hidden',
764 position: 'absolute',
765 borderCollapse: 'collapse',
771 var tbody = hs.createElement('tbody', null, null, this.table, 1);
774 for (var i = 0; i <= 8; i++) {
775 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
776 this.td[i] = hs.createElement('td', null, null, tr, true);
777 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
778 hs.setStyles(this.td[i], style);
780 this.td[4].className = outlineType +' highslide-outline';
782 this.preloadGraphic();
785 hs.Outline.prototype = {
786 preloadGraphic : function () {
787 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
789 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
790 this.graphic = hs.createElement('img', null, { position: 'absolute',
791 top: '-9999px' }, appendTo, true); // for onload trigger
794 this.graphic.onload = function() { pThis.onGraphicLoad(); };
796 this.graphic.src = src;
799 onGraphicLoad : function () {
800 var o = this.offset = this.graphic.width / 4,
801 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
802 dim = { height: (2*o) +'px', width: (2*o) +'px' };
803 for (var i = 0; i <= 8; i++) {
805 if (this.hasAlphaImageLoader) {
806 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
807 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
808 hs.createElement ('div', null, {
809 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
810 position: 'absolute',
812 height: this.graphic.height +'px',
813 left: (pos[i][0]*o)+'px',
814 top: (pos[i][1]*o)+'px'
819 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
822 if (window.opera && (i == 3 || i ==5))
823 hs.createElement('div', null, dim, this.td[i], true);
825 hs.setStyles (this.td[i], dim);
829 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
830 hs.pendingOutlines[this.outlineType] = this;
831 if (this.onLoad) this.onLoad();
834 setPosition : function (pos, offset, vis, dur, easing) {
836 stl = exp.wrapper.style,
837 offset = offset || 0,
839 x: exp.x.pos + offset,
840 y: exp.y.pos + offset,
841 w: exp.x.get('wsize') - 2 * offset,
842 h: exp.y.get('wsize') - 2 * offset
844 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
845 ? 'visible' : 'hidden';
846 hs.setStyles(this.table, {
847 left: (pos.x - this.offset) +'px',
848 top: (pos.y - this.offset) +'px',
849 width: (pos.w + 2 * this.offset) +'px'
852 pos.w -= 2 * this.offset;
853 pos.h -= 2 * this.offset;
854 hs.setStyles (this.td[4], {
855 width: pos.w >= 0 ? pos.w +'px' : 0,
856 height: pos.h >= 0 ? pos.h +'px' : 0
858 if (this.hasAlphaImageLoader) this.td[3].style.height
859 = this.td[5].style.height = this.td[4].style.height;
863 destroy : function(hide) {
864 if (hide) this.table.style.visibility = 'hidden';
865 else hs.discardElement(this.table);
869 hs.Dimension = function(exp, dim) {
872 this.ucwh = dim == 'x' ? 'Width' : 'Height';
873 this.wh = this.ucwh.toLowerCase();
874 this.uclt = dim == 'x' ? 'Left' : 'Top';
875 this.lt = this.uclt.toLowerCase();
876 this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
877 this.rb = this.ucrb.toLowerCase();
878 this.p1 = this.p2 = 0;
880 hs.Dimension.prototype = {
881 get : function(key) {
884 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
886 return this.size + 2 * this.cb + this.p1 + this.p2;
888 return this.clientSize - this.marginMin - this.marginMax;
890 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
892 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
894 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
896 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
900 calcBorders: function() {
901 // correct for borders
902 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
904 this.marginMax = hs['margin'+ this.ucrb];
906 calcThumb: function() {
907 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) :
908 this.exp.el['offset'+ this.ucwh];
909 this.tpos = this.exp.tpos[this.dim];
910 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
911 if (this.tpos == 0 || this.tpos == -1) {
912 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];
915 calcExpanded: function() {
917 this.justify = 'auto';
921 this.pos = this.tpos - this.cb + this.tb;
923 if (this.maxHeight && this.dim == 'x')
924 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full);
926 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
927 this.minSize = exp.allowSizeReduction ?
928 Math.min(exp['min'+ this.ucwh], this.full) :this.full;
929 if (exp.isImage && exp.useBox) {
930 this.size = exp[this.wh];
931 this.imgSize = this.full;
933 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
934 this.marginMin = hs['margin'+ this.uclt];
935 this.scroll = hs.page['scroll'+ this.uclt];
936 this.clientSize = hs.page[this.wh];
938 setSize: function(i) {
940 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
942 this.size = Math.max(this.size, this.imgSize);
943 exp.content.style[this.lt] = this.get('imgPad')+'px';
947 exp.content.style[this.wh] = i +'px';
948 exp.wrapper.style[this.wh] = this.get('wsize') +'px';
949 if (exp.outline) exp.outline.setPosition();
950 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
952 setPos: function(i) {
954 this.exp.wrapper.style[this.lt] = i +'px';
956 if (this.exp.outline) this.exp.outline.setPosition();
961 hs.Expander = function(a, params, custom, contentType) {
962 if (document.readyState && hs.ie && !hs.isReady) {
963 hs.addEventListener(document, 'ready', function() {
964 new hs.Expander(a, params, custom, contentType);
969 this.custom = custom;
970 this.contentType = contentType || 'image';
971 this.isImage = !this.isHtml;
973 hs.continuePreloading = false;
976 var key = this.key = hs.expanders.length;
977 // override inline parameters
978 for (var i = 0; i < hs.overrides.length; i++) {
979 var name = hs.overrides[i];
980 this[name] = params && typeof params[name] != 'undefined' ?
981 params[name] : hs[name];
983 if (!this.src) this.src = a.href;
986 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
987 el = this.thumb = el.getElementsByTagName('img')[0] || el;
988 this.thumbsUserSetId = el.id || a.id;
990 // check if already open
991 for (var i = 0; i < hs.expanders.length; i++) {
992 if (hs.expanders[i] && hs.expanders[i].a == a) {
993 hs.expanders[i].focus();
999 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
1000 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
1001 hs.expanders[i].cancelLoading();
1004 hs.expanders[key] = this;
1005 if (!hs.allowMultipleInstances && !hs.upcoming) {
1006 if (hs.expanders[key-1]) hs.expanders[key-1].close();
1007 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
1008 hs.expanders[hs.focusKey].close();
1013 this.tpos = this.pageOrigin || hs.getPosition(el);
1015 var x = this.x = new hs.Dimension(this, 'x');
1017 var y = this.y = new hs.Dimension(this, 'y');
1019 this.wrapper = hs.createElement(
1021 id: 'highslide-wrapper-'+ this.key,
1022 className: 'highslide-wrapper '+ this.wrapperClassName
1024 visibility: 'hidden',
1025 position: 'absolute',
1026 zIndex: hs.zIndexCounter += 2
1029 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
1030 if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
1031 this.outlineWhileAnimating = 0;
1034 if (!this.outlineType) {
1035 this[this.contentType +'Create']();
1037 } else if (hs.pendingOutlines[this.outlineType]) {
1038 this.connectOutline();
1039 this[this.contentType +'Create']();
1044 new hs.Outline(this.outlineType,
1046 exp.connectOutline();
1047 exp[exp.contentType +'Create']();
1054 hs.Expander.prototype = {
1055 error : function(e) {
1056 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message);
1057 else window.location.href = this.src;
1060 connectOutline : function() {
1061 var outline = this.outline = hs.pendingOutlines[this.outlineType];
1063 outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
1064 hs.pendingOutlines[this.outlineType] = null;
1067 showLoading : function() {
1068 if (this.onLoadStarted || this.loading) return;
1070 this.loading = hs.loading;
1072 this.loading.onclick = function() {
1073 exp.cancelLoading();
1076 l = this.x.get('loadingPos') +'px',
1077 t = this.y.get('loadingPos') +'px';
1078 setTimeout(function () {
1079 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
1083 imageCreate : function() {
1086 var img = document.createElement('img');
1088 img.onload = function () {
1089 if (hs.expanders[exp.key]) exp.contentLoaded();
1091 if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
1092 img.className = 'highslide-image';
1094 visibility: 'hidden',
1096 position: 'absolute',
1100 img.title = hs.lang.restoreTitle;
1101 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
1102 if (hs.ie && hs.flushImgSize) img.src = null;
1108 contentLoaded : function() {
1110 if (!this.content) return;
1111 this.content.onload = null;
1112 if (this.onLoadStarted) return;
1113 else this.onLoadStarted = true;
1115 var x = this.x, y = this.y;
1118 hs.setStyles(this.loading, { top: '-9999px' });
1119 this.loading = null;
1121 x.full = this.content.width;
1122 y.full = this.content.height;
1124 hs.setStyles(this.content, {
1128 this.wrapper.appendChild(this.content);
1129 hs.container.appendChild(this.wrapper);
1134 hs.setStyles (this.wrapper, {
1135 left: (x.tpos + x.tb - x.cb) +'px',
1136 top: (y.tpos + x.tb - y.cb) +'px'
1140 var ratio = x.full / y.full;
1146 if (this.overlayBox) this.sizeOverlayBox(0, 1);
1149 if (this.allowSizeReduction) {
1150 this.correctRatio(ratio);
1151 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
1152 this.createFullExpand();
1153 if (this.overlays.length == 1) this.sizeOverlayBox();
1163 justify : function (p, moveOnly) {
1164 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
1166 var hasMovedMin = false;
1168 var allowReduce = p.exp.allowSizeReduction;
1169 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
1170 if (p.pos < p.scroll + p.marginMin) {
1171 p.pos = p.scroll + p.marginMin;
1174 if (!moveOnly && p.size < p.minSize) {
1176 allowReduce = false;
1178 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
1179 if (!moveOnly && hasMovedMin && allowReduce) {
1180 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize'));
1181 } else if (p.get('wsize') < p.get('fitsize')) {
1182 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
1183 } else { // image larger than viewport
1184 p.pos = p.scroll + p.marginMin;
1185 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
1189 if (!moveOnly && p.size < p.minSize) {
1191 allowReduce = false;
1196 if (p.pos < p.marginMin) {
1198 p.pos = p.marginMin;
1200 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
1205 correctRatio : function(ratio) {
1209 xSize = Math.min(x.full, x.size),
1210 ySize = Math.min(y.full, y.size),
1211 useBox = (this.useBox || hs.padToMinWidth);
1213 if (xSize / ySize > ratio) { // width greater
1214 xSize = ySize * ratio;
1215 if (xSize < x.minSize) { // below minWidth
1217 ySize = xSize / ratio;
1221 } else if (xSize / ySize < ratio) { // height greater
1222 ySize = xSize / ratio;
1226 if (hs.padToMinWidth && x.full < x.minSize) {
1228 y.size = y.imgSize = y.full;
1229 } else if (this.useBox) {
1236 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed);
1237 if (useBox && y.size < y.imgSize) {
1239 x.imgSize = y.size * ratio;
1241 if (changed || useBox) {
1242 x.pos = x.tpos - x.cb + x.tb;
1244 this.justify(x, true);
1246 y.pos = y.tpos - y.cb + y.tb;
1248 this.justify(y, true);
1249 if (this.overlayBox) this.sizeOverlayBox();
1254 fitOverlayBox : function(ratio, changed) {
1255 var x = this.x, y = this.y;
1256 if (this.overlayBox) {
1257 while (y.size > this.minHeight && x.size > this.minWidth
1258 && y.get('wsize') > y.get('fitsize')) {
1260 if (ratio) x.size = y.size * ratio;
1261 this.sizeOverlayBox(0, 1);
1268 show : function () {
1269 var x = this.x, y = this.y;
1270 this.doShowHide('hidden');
1272 // Apply size change
1276 width : x.get('wsize'),
1277 height : y.get('wsize'),
1282 left: x.p1 + x.get('imgPad'),
1283 top: y.p1 + y.get('imgPad'),
1284 width:x.imgSize ||x.size,
1285 height:y.imgSize ||y.size
1292 changeSize : function(up, to, dur) {
1294 if (this.outline && !this.outlineWhileAnimating) {
1295 if (up) this.outline.setPosition();
1296 else this.outline.destroy();
1300 if (!up) this.destroyOverlays();
1305 easing = this.easing;
1306 if (!up) easing = this.easingClose || easing;
1310 if (exp.outline) exp.outline.table.style.visibility = "visible";
1311 setTimeout(function() {
1318 if (up) hs.setStyles( this.wrapper, {
1322 if (this.fadeInOut) {
1323 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
1324 hs.extend(to.wrapper, { opacity: up });
1326 hs.animate( this.wrapper, to.wrapper, {
1329 step: function(val, args) {
1330 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
1331 var fac = up ? args.pos : 1 - args.pos;
1333 w: x.t + (x.get('wsize') - x.t) * fac,
1334 h: y.t + (y.get('wsize') - y.t) * fac,
1335 x: x.tpos + (x.pos - x.tpos) * fac,
1336 y: y.tpos + (y.pos - y.tpos) * fac
1338 exp.outline.setPosition(pos, 0, 1);
1342 hs.animate( this.content, to.content, dur, easing, after);
1344 this.wrapper.style.visibility = 'visible';
1345 this.content.style.visibility = 'visible';
1346 this.a.className += ' highslide-active-anchor';
1353 afterExpand : function() {
1354 this.isExpanded = true;
1356 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
1357 this.prepareNextOutline();
1358 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
1359 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
1360 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
1361 if (this.overlayBox) this.showOverlays();
1366 prepareNextOutline : function() {
1368 var outlineType = this.outlineType;
1369 new hs.Outline(outlineType,
1370 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
1374 preloadNext : function() {
1375 var next = this.getAdjacentAnchor(1);
1376 if (next && next.onclick.toString().match(/hs\.expand/))
1377 var img = hs.createElement('img', { src: hs.getSrc(next) });
1381 getAdjacentAnchor : function(op) {
1382 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];
1383 return (as && as[current + op]) || null;
1386 getAnchorIndex : function() {
1387 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
1388 if (arr) for (var i = 0; i < arr.length; i++) {
1389 if (arr[i] == this.a) return i;
1395 cancelLoading : function() {
1396 hs.discardElement (this.wrapper);
1397 hs.expanders[this.key] = null;
1398 if (this.loading) hs.loading.style.left = '-9999px';
1401 writeCredits : function () {
1402 this.credits = hs.createElement('a', {
1403 href: hs.creditsHref,
1404 target: hs.creditsTarget,
1405 className: 'highslide-credits',
1406 innerHTML: hs.lang.creditsText,
1407 title: hs.lang.creditsTitle
1409 this.createOverlay({
1410 overlayId: this.credits,
1411 position: this.creditsPosition || 'top left'
1415 getInline : function(types, addOverlay) {
1416 for (var i = 0; i < types.length; i++) {
1417 var type = types[i], s = null;
1418 if (!this[type +'Id'] && this.thumbsUserSetId)
1419 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
1420 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
1421 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
1422 s = eval(this[type +'Eval']);
1424 if (!this[type] && this[type +'Text']) {
1425 s = this[type +'Text'];
1427 if (!this[type] && !s) {
1428 this[type] = hs.getNode(this.a['_'+ type + 'Id']);
1430 var next = this.a.nextSibling;
1431 while (next && !hs.isHsAnchor(next)) {
1432 if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
1433 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++;
1434 this[type] = hs.getNode(next.id);
1437 next = next.nextSibling;
1442 if (!this[type] && s) this[type] = hs.createElement('div',
1443 { className: 'highslide-'+ type, innerHTML: s } );
1445 if (addOverlay && this[type]) {
1446 var o = { position: (type == 'heading') ? 'above' : 'below' };
1447 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
1448 o.overlayId = this[type];
1449 this.createOverlay(o);
1455 // on end move and resize
1456 doShowHide : function(visibility) {
1457 if (hs.hideSelects) this.showHideElements('SELECT', visibility);
1458 if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
1459 if (hs.geckoMac) this.showHideElements('*', visibility);
1461 showHideElements : function (tagName, visibility) {
1462 var els = document.getElementsByTagName(tagName);
1463 var prop = tagName == '*' ? 'overflow' : 'visibility';
1464 for (var i = 0; i < els.length; i++) {
1465 if (prop == 'visibility' || (document.defaultView.getComputedStyle(
1466 els[i], "").getPropertyValue('overflow') == 'auto'
1467 || els[i].getAttribute('hidden-by') != null)) {
1468 var hiddenBy = els[i].getAttribute('hidden-by');
1469 if (visibility == 'visible' && hiddenBy) {
1470 hiddenBy = hiddenBy.replace('['+ this.key +']', '');
1471 els[i].setAttribute('hidden-by', hiddenBy);
1472 if (!hiddenBy) els[i].style[prop] = els[i].origProp;
1473 } else if (visibility == 'hidden') { // hide if behind
1474 var elPos = hs.getPosition(els[i]);
1475 elPos.w = els[i].offsetWidth;
1476 elPos.h = els[i].offsetHeight;
1479 var clearsX = (elPos.x + elPos.w < this.x.get('opos')
1480 || elPos.x > this.x.get('opos') + this.x.get('osize'));
1481 var clearsY = (elPos.y + elPos.h < this.y.get('opos')
1482 || elPos.y > this.y.get('opos') + this.y.get('osize'));
1483 var wrapperKey = hs.getWrapperKey(els[i]);
1484 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
1486 els[i].setAttribute('hidden-by', '['+ this.key +']');
1487 els[i].origProp = els[i].style[prop];
1488 els[i].style[prop] = 'hidden';
1490 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
1491 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
1493 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
1494 && wrapperKey != this.key) { // on move
1495 els[i].setAttribute('hidden-by', '');
1496 els[i].style[prop] = els[i].origProp || '';
1497 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
1498 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
1506 focus : function() {
1507 this.wrapper.style.zIndex = hs.zIndexCounter += 2;
1509 for (var i = 0; i < hs.expanders.length; i++) {
1510 if (hs.expanders[i] && i == hs.focusKey) {
1511 var blurExp = hs.expanders[i];
1512 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
1513 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer';
1514 blurExp.content.title = hs.lang.focusTitle;
1519 if (this.outline) this.outline.table.style.zIndex
1520 = this.wrapper.style.zIndex - 1;
1521 this.content.className = 'highslide-'+ this.contentType;
1522 this.content.title = hs.lang.restoreTitle;
1524 if (hs.restoreCursor) {
1525 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
1526 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
1527 this.content.style.cursor = hs.styleRestoreCursor;
1530 hs.focusKey = this.key;
1531 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
1533 moveTo: function(x, y) {
1537 resize : function (e) {
1538 var w, h, r = e.width / e.height;
1539 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
1540 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
1542 if (h < Math.min(this.minHeight, this.y.full)) {
1543 h = Math.min(this.minHeight, this.y.full);
1544 if (this.isImage) w = h * r;
1546 this.resizeTo(w, h);
1548 resizeTo: function(w, h) {
1551 this.wrapper.style.height = this.y.get('wsize') +'px';
1554 close : function() {
1555 if (this.isClosing || !this.isExpanded) return;
1556 this.isClosing = true;
1558 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
1561 this.content.style.cursor = 'default';
1567 left: this.x.tpos - this.x.cb + this.x.tb,
1568 top: this.y.tpos - this.y.cb + this.y.tb
1576 }, hs.restoreDuration
1578 } catch (e) { this.afterClose(); }
1581 createOverlay : function (o) {
1582 var el = o.overlayId;
1583 if (typeof el == 'string') el = hs.getNode(el);
1584 if (o.html) el = hs.createElement('div', { innerHTML: o.html });
1585 if (!el || typeof el == 'string') return;
1586 el.style.display = 'block';
1587 this.genOverlayBox();
1588 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
1589 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
1590 var overlay = hs.createElement(
1592 id: 'hsId'+ hs.idCounter++,
1595 position: 'absolute',
1596 visibility: 'hidden',
1598 direction: hs.lang.cssDirection || '',
1604 overlay.appendChild(el);
1605 hs.extend(overlay, {
1609 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
1611 hs.extend(overlay, o);
1614 if (this.gotOverlays) {
1615 this.positionOverlay(overlay);
1616 if (!overlay.hideOnMouseOut || this.mouseIsOver)
1617 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
1619 hs.push(this.overlays, hs.idCounter - 1);
1621 positionOverlay : function(overlay) {
1622 var p = overlay.position || 'middle center',
1623 offX = overlay.offsetX,
1624 offY = overlay.offsetY;
1625 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
1626 if (/left$/.test(p)) overlay.style.left = offX +'px';
1628 if (/center$/.test(p)) hs.setStyles (overlay, {
1630 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
1633 if (/right$/.test(p)) overlay.style.right = - offX +'px';
1635 if (/^leftpanel$/.test(p)) {
1636 hs.setStyles(overlay, {
1638 marginRight: this.x.cb +'px',
1639 top: - this.y.cb +'px',
1640 bottom: - this.y.cb +'px',
1643 this.x.p1 = overlay.offsetWidth;
1645 } else if (/^rightpanel$/.test(p)) {
1646 hs.setStyles(overlay, {
1648 marginLeft: this.x.cb +'px',
1649 top: - this.y.cb +'px',
1650 bottom: - this.y.cb +'px',
1653 this.x.p2 = overlay.offsetWidth;
1656 if (/^top/.test(p)) overlay.style.top = offY +'px';
1657 if (/^middle/.test(p)) hs.setStyles (overlay, {
1659 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
1661 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
1662 if (/^above$/.test(p)) {
1663 hs.setStyles(overlay, {
1664 left: (- this.x.p1 - this.x.cb) +'px',
1665 right: (- this.x.p2 - this.x.cb) +'px',
1667 marginBottom: this.y.cb +'px',
1670 this.y.p1 = overlay.offsetHeight;
1672 } else if (/^below$/.test(p)) {
1673 hs.setStyles(overlay, {
1674 position: 'relative',
1675 left: (- this.x.p1 - this.x.cb) +'px',
1676 right: (- this.x.p2 - this.x.cb) +'px',
1678 marginTop: this.y.cb +'px',
1681 this.y.p2 = overlay.offsetHeight;
1682 overlay.style.position = 'absolute';
1686 getOverlays : function() {
1687 this.getInline(['heading', 'caption'], true);
1688 if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
1689 if (hs.showCredits) this.writeCredits();
1690 for (var i = 0; i < hs.overlays.length; i++) {
1691 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
1692 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
1693 || (sg && sg === this.slideshowGroup)) {
1694 this.createOverlay(o);
1698 for (var i = 0; i < this.overlays.length; i++) {
1699 var o = hs.$('hsId'+ this.overlays[i]);
1700 if (/panel$/.test(o.position)) this.positionOverlay(o);
1701 else hs.push(os, o);
1703 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
1704 this.gotOverlays = true;
1706 genOverlayBox : function() {
1707 if (!this.overlayBox) this.overlayBox = hs.createElement (
1709 className: this.wrapperClassName
1711 position : 'absolute',
1712 width: (this.x.size || (this.useBox ? this.width : null)
1713 || this.x.full) +'px',
1714 height: (this.y.size || this.y.full) +'px',
1715 visibility : 'hidden',
1716 overflow : 'hidden',
1717 zIndex : hs.ie ? 4 : 'auto'
1723 sizeOverlayBox : function(doWrapper, doPanels) {
1724 var overlayBox = this.overlayBox,
1727 hs.setStyles( overlayBox, {
1728 width: x.size +'px',
1729 height: y.size +'px'
1731 if (doWrapper || doPanels) {
1732 for (var i = 0; i < this.overlays.length; i++) {
1733 var o = hs.$('hsId'+ this.overlays[i]);
1734 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
1735 if (o && /^(above|below)$/.test(o.position)) {
1737 o.style.width = (overlayBox.offsetWidth + 2 * x.cb
1738 + x.p1 + x.p2) +'px';
1740 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
1742 if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
1743 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
1748 hs.setStyles(this.content, {
1751 hs.setStyles(overlayBox, {
1752 top: (y.p1 + y.cb) +'px'
1757 showOverlays : function() {
1758 var b = this.overlayBox;
1761 top: (this.y.p1 + this.y.cb) +'px',
1762 left: (this.x.p1 + this.x.cb) +'px',
1763 overflow : 'visible'
1765 if (hs.safari) b.style.visibility = 'visible';
1766 this.wrapper.appendChild (b);
1767 for (var i = 0; i < this.overlays.length; i++) {
1768 var o = hs.$('hsId'+ this.overlays[i]);
1769 o.style.zIndex = o.zIndex || 4;
1770 if (!o.hideOnMouseOut || this.mouseIsOver) {
1771 o.style.visibility = 'visible';
1772 hs.setStyles(o, { visibility: 'visible', display: '' });
1773 hs.animate(o, { opacity: o.opacity }, o.dur);
1778 destroyOverlays : function() {
1779 if (!this.overlays.length) return;
1780 hs.discardElement(this.overlayBox);
1785 createFullExpand : function () {
1786 this.fullExpandLabel = hs.createElement(
1788 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
1789 title: hs.lang.fullExpandTitle,
1790 className: 'highslide-full-expand'
1794 this.createOverlay({
1795 overlayId: this.fullExpandLabel,
1796 position: hs.fullExpandPosition,
1797 hideOnMouseOut: true,
1798 opacity: hs.fullExpandOpacity
1802 doFullExpand : function () {
1804 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
1807 var xSize = this.x.size,
1808 ySize = this.y.size;
1809 this.resizeTo(this.x.full, this.y.full);
1811 var xpos = this.x.pos - (this.x.size - xSize) / 2;
1812 if (xpos < hs.marginLeft) xpos = hs.marginLeft;
1814 var ypos = this.y.pos - (this.y.size - ySize) / 2;
1815 if (ypos < hs.marginTop) ypos = hs.marginTop;
1817 this.moveTo(xpos, ypos);
1818 this.doShowHide('hidden');
1826 afterClose : function () {
1827 this.a.className = this.a.className.replace('highslide-active-anchor', '');
1829 this.doShowHide('visible');
1830 if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
1832 hs.discardElement(this.wrapper);
1834 hs.expanders[this.key] = null;
1839 hs.langDefaults = hs.lang;
1841 var HsExpander = hs.Expander;
1842 if (hs.ie && window == window.top) {
1845 document.documentElement.doScroll('left');
1847 setTimeout(arguments.callee, 50);
1853 hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
1854 hs.addEventListener(window, 'load', hs.ready);
1857 hs.addEventListener(document, 'ready', function() {
1858 if (hs.expandCursor) {
1859 var style = hs.createElement('style', { type: 'text/css' }, null,
1860 document.getElementsByTagName('HEAD')[0]),
1861 backCompat = document.compatMode == 'BackCompat';
1864 function addRule(sel, dec) {
1865 if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
1866 var last = document.styleSheets[document.styleSheets.length - 1];
1867 if (typeof(last.addRule) == "object") last.addRule(sel, dec);
1869 style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
1872 function fix(prop) {
1873 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
1874 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
1876 if (hs.expandCursor) addRule ('.highslide img',
1877 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;');
1880 hs.addEventListener(window, 'resize', function() {
1883 hs.addEventListener(document, 'mousemove', function(e) {
1884 hs.mouse = { x: e.clientX, y: e.clientY };
1886 hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
1887 hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
1889 hs.addEventListener(document, 'ready', hs.getAnchors);
1890 hs.addEventListener(window, 'load', hs.preloadImages);