PageSourceSearch

https://www.beavercreekreserve.org/js/highslide-full.js?v=1467223250

js beavercreekreserve.org collected 2026-10-04 00:26:07 UTC 107,061 bytes, 3,319 lines download raw bytes

1/** 
2 * Name:    Highslide JS
3 * Version: 4.1.13 (2011-10-06)
4 * Config:  default +events +unobtrusive +imagemap +slideshow +positioning +transitions +viewport +thumbstrip +inline +ajax +iframe +flash
5 * Author:  Torstein Hønsi
6 * Support: www.highslide.com/support
7 * License: www.highslide.com/100029488003100
8 */
9if (!hs) { var hs = {
10// Language strings
11  lang : {
12  cssDirection: 'ltr',
13  loadingText : 'Loading...',
14  loadingTitle : 'Click to cancel',
15  focusTitle : 'Click to bring to front',
16  fullExpandTitle : 'Expand to actual size (f)',
17  creditsText : '',
18  creditsTitle : '',
19  previousText : 'Previous',
20  nextText : 'Next', 
21  moveText : '',
22  closeText : 'Close', 
23  closeTitle : 'Close (esc)', 
24  resizeTitle : 'Resize',
25  playText : 'Play',
26  playTitle : 'Play slideshow (spacebar)',
27  pauseText : 'Pause',
28  pauseTitle : 'Pause slideshow (spacebar)',
29  previousTitle : 'Previous (arrow left)',
30  nextTitle : 'Next (arrow right)',
31  moveTitle : 'Move',
32  fullExpandText : '1:1',
33  number: 'Image %1 of %2',
34  restoreTitle : 'Click to close image. Use arrow keys for next and previous.'
35},
36// See http://highslide.com/ref for examples of settings  
37graphicsDir : '/highslide/images/',
38expandCursor : null, // null disables
39restoreCursor : null, // null disables
40expandDuration : 250, // milliseconds
41restoreDuration : 250,
42marginLeft : 20,
43marginRight : 20,
44marginTop : 20,
45marginBottom : 20,
46zIndexCounter : 9999, // adjust to other absolutely positioned elements
47loadingOpacity : 0.75,
48allowMultipleInstances: true,
49numberOfImagesToPreload : 5,
50outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 
51outlineStartOffset : 3, // ends at 10
52padToMinWidth : true, // pad the popup width to make room for wide caption
53fullExpandPosition : 'top left',
54fullExpandOpacity : 1,
55showCredits : false, // you can set this to false if you want
56creditsHref : '',
57creditsTarget : '_blank',
58enableKeyListener : true,
59openerTagNames : ['a', 'area'], // Add more to allow slideshow indexing
60transitions : [],
61transitionDuration: 250,
62dimmingOpacity: 0.85, // Lightbox style dimming background
63dimmingDuration: 50, // 0 for instant dimming
64allowWidthReduction : false,
65allowHeightReduction : true,
66preserveContent : false, // Preserve changes made to the content and position of HTML popups.
67objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion.
68cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup.
69anchor : 'auto', // where the image expands from
70align : 'center', // position in the client (overrides anchor)
71targetX: null, // the id of a target element
72targetY: null,
73dragByHeading: false,
74minWidth: 200,
75minHeight: 300,
76captionEval: 'this.a.title',
77allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight
78wrapperClassName: 'borderless no-footer',
79outlineType : 'drop-shadow', // set null to disable outlines
80skin : {
81controls:
82'<div class="highslide-controls"><ul>'+
83'<li class="highslide-previous">'+
84'<a href="#" title="{hs.lang.previousTitle}">'+
85'<span>{hs.lang.previousText}</span></a>'+
86'</li>'+
87'<li class="highslide-play">'+
88'<a href="#" title="{hs.lang.playTitle}">'+
89'<span>{hs.lang.playText}</span></a>'+
90'</li>'+
91'<li class="highslide-pause">'+
92'<a href="#" title="{hs.lang.pauseTitle}">'+
93'<span>{hs.lang.pauseText}</span></a>'+
94'</li>'+
95'<li class="highslide-next">'+
96'<a href="#" title="{hs.lang.nextTitle}">'+
97'<span>{hs.lang.nextText}</span></a>'+
98'</li>'+
99'<li class="highslide-move">'+
100'<a href="#" title="{hs.lang.moveTitle}">'+
101'<span>{hs.lang.moveText}</span></a>'+
102'</li>'+
103'<li class="highslide-full-expand">'+
104'<a href="#" title="{hs.lang.fullExpandTitle}">'+
105'<span>{hs.lang.fullExpandText}</span></a>'+
106'</li>'+
107'<li class="highslide-close">'+
108'<a href="#" title="{hs.lang.closeTitle}" >'+
109'<span>{hs.lang.closeText}</span></a>'+
110'</li>'+
111'</ul></div>'
112,
113contentWrapper:
114'<div class="highslide-header"><ul>'+
115'<li class="highslide-previous">'+
116'<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+
117'<span>{hs.lang.previousText}</span></a>'+
118'</li>'+
119'<li class="highslide-next">'+
120'<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+
121'<span>{hs.lang.nextText}</span></a>'+
122'</li>'+
123'<li class="highslide-move">'+
124'<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+
125'<span>{hs.lang.moveText}</span></a>'+
126'</li>'+
127'<li class="highslide-close">'+
128'<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+
129'<span>{hs.lang.closeText}</span></a>'+
130'</li>'+
131'</ul></div>'+
132'<div class="highslide-body"></div>'+
133'<div class="highslide-footer"><div>'+
134'<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+
135'</div></div>'
136},
137// END OF YOUR SETTINGS
138
139
140// declare internal properties
141preloadTheseImages : [],
142continuePreloading: true,
143expanders : [],
144overrides : [
145  'allowSizeReduction',
146  'useBox',
147  'anchor',
148  'align',
149  'targetX',
150  'targetY',
151  'outlineType',
152  'outlineWhileAnimating',
153  'captionId',
154  'captionText',
155  'captionEval',
156  'captionOverlay',
157  'headingId',
158  'headingText',
159  'headingEval',
160  'headingOverlay',
161  'creditsPosition',
162  'dragByHeading',
163  'autoplay',
164  'numberPosition',
165  'transitions',
166  'dimmingOpacity',
167  'width',
168  'height',
169  'contentId',
170  'allowWidthReduction',
171  'allowHeightReduction',
172  'preserveContent',
173  'maincontentId',
174  'maincontentText',
175  'maincontentEval',
176  'objectType',  
177  'cacheAjax',  
178  'objectWidth',
179  'objectHeight',
180  'objectLoadTime',  
181  'swfOptions',
182  'wrapperClassName',
183  'minWidth',
184  'minHeight',
185  'maxWidth',
186  'maxHeight',
187  'pageOrigin',
188  'slideshowGroup',
189  'easing',
190  'easingClose',
191  'fadeInOut',
192  'src'
193],
194overlays : [],
195idCounter : 0,
196oPos : {
197  x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
198  y: ['above', 'top', 'middle', 'bottom', 'below']
199},
200mouse: {},
201headingOverlay: {},
202captionOverlay: {},
203swfOptions: { flashvars: {}, params: {}, attributes: {} },
204timers : [],
205
206slideshows : [],
207
208pendingOutlines : {},
209sleeping : [],
210preloadTheseAjax : [],
211cacheBindings : [],
212cachedGets : {},
213clones : {},
214onReady: [],
215uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 :
216  parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]),
217ie : (document.all && !window.opera),
218//ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant?
219safari : /Safari/.test(navigator.userAgent),
220geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
221
222$ : function (id) {
223    if (id) return document.getElementById(id);
224},
225
226push : function (arr, val) {
227    arr[arr.length] = val;
228},
229
230createElement : function (tag, attribs, styles, parent, nopad) {
231    var el = document.createElement(tag);
232    if (attribs) hs.extend(el, attribs);
233    if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
234    if (styles) hs.setStyles(el, styles);
235    if (parent) parent.appendChild(el);  
236    return el;
237},
238
239extend : function (el, attribs) {
240    for (var x in attribs) el[x] = attribs[x];
241    return el;
242},
243
244setStyles : function (el, styles) {
245    for (var x in styles) {
246      if (hs.ieLt9 && x == 'opacity') {
247        if (styles[x] > 0.99) el.style.removeAttribute('filter');
248          else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
249        }
250        else el.style[x] = styles[x];    
251      }
252    },
253animate: function(el, prop, opt) {
254    var start,
255      end,
256      unit;
257    if (typeof opt != 'object' || opt === null) {
258      var args = arguments;
259      opt = {
260        duration: args[2],
261        easing: args[3],
262        complete: args[4]
263      };
264    }
265    if (typeof opt.duration != 'number') opt.duration = 250;
266    opt.easing = Math[opt.easing] || Math.easeInQuad;
267    opt.curAnim = hs.extend({}
267, prop);
268    for (var name in prop) {
269      var e = new hs.fx(el, opt , name );
270      
271      start = parseFloat(hs.css(el, name)) || 0;
272      end = parseFloat(prop[name]);
273      unit = name != 'opacity' ? 'px' : '';
274      
275      e.custom( start, end, unit );
276    }  
277},
278css: function(el, prop) {
279    if (el.style[prop]) {
280      return el.style[prop];
281    } else if (document.defaultView) {
282      return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);
283
284    } else {
285      if (prop == 'opacity') prop = 'filter';
286      var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
287      if (prop == 'filter') 
288        val = val.replace(/alpha\(opacity=([0-9]+)\)/, 
289          function (a, b) { return b / 100 });
290      return val === '' ? 1 : val;
291    } 
292},
293
294getPageSize : function () {
295    var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 
296      ? d.documentElement : d.body,
297      ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined');
298    
299    var width = ieLt9 ? iebody.clientWidth : 
300        (d.documentElement.clientWidth || self.innerWidth),
301      height = ieLt9 ? iebody.clientHeight : self.innerHeight;
302    hs.page = {
303      width: width,
304      height: height,    
305      scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset,
306      scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset
307    };
308    return hs.page;
309},
310
311getPosition : function(el)  {
312    if (/area/i.test(el.tagName)) {
313      var imgs = document.getElementsByTagName('img');
314      for (var i = 0; i < imgs.length; i++) {
315        var u = imgs[i].useMap;
316        if (u && u.replace(/^.*?#/, '') == el.parentNode.name) {
317          el = imgs[i];
318          break;
319        }
320      }
321    }
322    var p = { x: el.offsetLeft, y: el.offsetTop };
323    while (el.offsetParent)  {
324      el = el.offsetParent;
325      p.x += el.offsetLeft;
326      p.y += el.offsetTop;
327      if (el != document.body && el != document.documentElement) {
328        p.x -= el.scrollLeft;
329        p.y -= el.scrollTop;
330      }
331    }
332    return p;
333},
334
335expand : function(a, params, custom, type) {
336    if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
337    if (typeof a.getParams == 'function') return params;
338    if (type == 'html') {
339      for (var i = 0; i < hs.sleeping.length; i++) {
340        if (hs.sleeping[i] && hs.sleeping[i].a == a) {
341          hs.sleeping[i].awake();
342          hs.sleeping[i] = null;
343          return false;
344        }
345      }
346      hs.hasHtmlExpanders = true;
347    }  
348    try {  
349      new hs.Expander(a, params, custom, type);
350      return false;
351    } catch (e) { return true; }
352},
353
354htmlExpand : function(a, params, custom) {
355    return hs.expand(a, params, custom, 'html');
356},
357
358getSelfRendered : function() {
359    return hs.createElement('div', { 
360      className: 'highslide-html-content', 
361      innerHTML: hs.replaceLang(hs.skin.contentWrapper) 
362    });
363},
364getElementByClass : function (el, tagName, className) {
365    var els = el.getElementsByTagName(tagName);
366    for (var i = 0; i < els.length; i++) {
367    if ((new RegExp(className)).test(els[i].className)) {
368        return els[i];
369      }
370    }
371    return null;
372},
373replaceLang : function(s) {
374    s = s.replace(/\s/g, ' ');
375    var re = /{hs\.lang\.([^}]+)\}/g,
376      matches = s.match(re),
377      lang;
378    if (matches) for (var i = 0; i < matches.length; i++) {
379      lang = matches[i].replace(re, "$1");
380      if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]);
381    }
382    return s;
383},
384
385
386setClickEvents : function () {
387    var els = document.getElementsByTagName('a');
388    for (var i = 0; i < els.length; i++) {
389      var type = hs.isUnobtrusiveAnchor(els[i]);
390      if (type && !els[i].hsHasSetClick) {
391        (function(){
392          var t = type;
393          if (hs.fireEvent(hs, 'onSetClickEvent', { element: els[i], type: t })) {
394            els[i].onclick =(type == 'image') ?function() { return hs.expand(this) }:
395              function() { return hs.htmlExpand(this, { objectType: t } );};
396          }
397        })();
398        els[i].hsHasSetClick = true;  
399      }
400    }
401    hs.getAnchors();
402},
403isUnobtrusiveAnchor: function(el) {
404    if (el.rel == 'highslide') return 'image';
405    else if (el.rel == 'highslide-ajax') return 'ajax';
406    else if (el.rel == 'highslide-iframe') return 'iframe';
407    else if (el.rel == 'highslide-swf') return 'swf';
408},
409
410getCacheBinding : function (a) {
411    for (var i = 0; i < hs.cacheBindings.length; i++) {
412      if (hs.cacheBindings[i][0] == a) {
413        var c = hs.cacheBindings[i][1];
414        hs.cacheBindings[i][1] = c.cloneNode(1);
415        return c;
416      }
417    }
418    return null;
419},
420
421preloadAjax : function (e) {
422    var arr = hs.getAnchors();
423    for (var i = 0; i < arr.htmls.length; i++) {
424      var a = arr.htmls[i];
425      if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax'))
426        hs.push(hs.preloadTheseAjax, a);
427    }
428    
429    hs.preloadAjaxElement(0);
430},
431
432preloadAjaxElement : function (i) {
433    if (!hs.preloadTheseAjax[i]) return;
434    var a = hs.preloadTheseAjax[i];
435    var cache = hs.getNode(hs.getParam(a, 'contentId'));
436    if (!cache) cache = hs.getSelfRendered();
437    var ajax = new hs.Ajax(a, cache, 1);  
438    ajax.onError = function () { };
439    ajax.onLoad = function () {
440      hs.push(hs.cacheBindings, [a, cache]);
441      hs.preloadAjaxElement(i + 1);
442    };
443    ajax.run();
444},
445
446focusTopmost : function() {
447    var topZ = 0, 
448      topmostKey = -1,
449      expanders = hs.expanders,
450      exp,
451      zIndex;
452    for (var i = 0; i < expanders.length; i++) {
453      exp = expanders[i];
454      if (exp) {
455        zIndex = exp.wrapper.style.zIndex;
456        if (zIndex && zIndex > topZ) {
457          topZ = zIndex;        
458          topmostKey = i;
459        }
460      }
461    }
462    if (topmostKey == -1) hs.focusKey = -1;
463    else expanders[topmostKey].focus();
464},
465
466getParam : function (a, param) {
467    a.getParams = a.onclick;
468    var p = a.getParams ? a.getParams() : null;
469    a.getParams = null;
470    
471    return (p && typeof p[param] != 'undefined') ? p[param] : 
472      (typeof hs[param] != 'undefined' ? hs[param] : null);
473},
474
475getSrc : function (a) {
476    var src = hs.getParam(a, 'src');
477    if (src) return src;
478    return a.href;
479},
480
481getNode : function (id) {
482    var node = hs.$(id), clone = hs.clones[id], a = {};
483    if (!node && !clone) return null;
484    if (!clone) {
485      clone = node.cloneNode(true);
486      clone.id = '';
487      hs.clones[id] = clone;
488      return node;
489    } else {
490      return clone.cloneNode(true);
491    }
492},
493
494discardElement : function(d) {
495    if (d) hs.garbageBin.appendChild(d);
496    hs.garbageBin.innerHTML = '';
497},
498dim : function(exp) {
499    if (!hs.dimmer) {
500      isNew = true;
501      hs.dimmer = hs.createElement ('div', {
502          className: 'highslide-dimming highslide-viewport-size',
503          owner: '',
504          onclick: function() {
505            if (hs.fireEvent(hs, 'onDimmerClick'))
506            
507              hs.close();
508          }
509        }, {
510visibility: 'visible',
511          opacity: 0
512        }, hs.container, true);
513        
514      if (/(Android|iPad|iPhone|iPod)/.test(navigator.userAgent)) {
515        var body = document.body;
516        function pixDimmerSize() {
517          hs.setStyles(hs.dimmer, {
518            width: body.scrollWidth +'px',
519            height: body.scrollHeight +'px'
520          });
521        }
522        pixDimmerSize();
523        hs.addEventListener(window, 'resize', pixDimmerSize);
524      }
525    }
526    hs.dimmer.style.display = '';
527
528    var isNew = hs.dimmer.owner == '';
529    hs.dimmer.owner += '|'+ exp.key;
530    
531    if (isNew) {
532      if (hs.geckoMac && hs.dimmingGeckoFix)
533        hs.setStyles(hs.dimmer, {
534          background: 'url('+ hs.graphicsDir + 'geckodimmer.png)',
535          opacity: 1
536        });
537      else
538        hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration);
539    }
540},
541undim : function(key) {
542    if (!hs.dimmer) return;
543    if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, '');
544
545    if (
546      (typeof key != 'undefined' && hs.dimmer.owner != '')
547      || (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
548    ) return;
549
550    if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none';
551    else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() {
552      hs.dimmer.style.display = 'none';
553    });
554},
555transit : function (adj, exp) {
556    var last = exp || hs.getExpander();
557    exp = last;
558    if (hs.upcoming) return false;
559    else hs.last = last;
560    hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
561    try {
562      hs.upcoming = adj;
563      adj.onclick();     
564    } catch (e){
565      hs.last = hs.upcoming = null;
566    }
567    try {
568      if (!adj || exp.transitions[1] != 'crossfade')
569      exp.close();
570    } catch (e) {}
571    return false;
572},
573
574previousOrNext : function (el, op) {
575    var exp = hs.getExpander(el);
576    if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp);
577    else return false;
578},
579
580previous : function (el) {
581    return hs.previousOrNext(el, -1);
582},
583
584next : function (el) {
585    return hs.previousOrNext(el, 1);  
586},
587
588keyHandler : function(e) {
589    if (!e) e = window.event;
590    if (!e.target) e.target = e.srcElement; // ie
591    if (typeof e.target.form != 'undefined') return true; // form element has focus
592    if (!hs.fireEvent(hs, 'onKeyDown', e)) return true;
593    var exp = hs.getExpander();
594    
595    var op = null;
596    switch (e.keyCode) {
597      case 70: // f
598        if (exp) exp.doFullExpand();
599        return true;
600      case 32: // Space
601        op = 2;
602        break;
603      case 34: // Page Down
604      case 39: // Arrow right
605      case 40: // Arrow down
606        op = 1;
607        break;
608      case 8:  // Backspace
609      case 33: // Page Up
610      case 37: // Arrow left
611      case 38: // Arrow up
612        op = -1;
613        break;
614      case 27: // Escape
615      case 13: // Enter
616        op = 0;
617    }
618    if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
619      if (!hs.enableKeyListener) return true;
620      
621      if (e.preventDefault) e.preventDefault();
622    else e.returnValue = false;
623    if (exp) {
624        if (op == 0) {
625          exp.close();
626        } else if (op == 2) {
627          if (exp.slideshow) exp.slideshow.hitSpace();
628        } else {
629          if (exp.slideshow) exp.slideshow.pause();
630          hs.previousOrNext(exp.key, op);
631        }
632        return false;
633      }
634    }
635    return true;
636},
637
638
639registerOverlay : function (overlay) {
640    hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } ));
641},
642
643
644addSlideshow : function (options) {
645    var sg = options.slideshowGroup;
646    if (typeof sg == 'object') {
647      for (var i = 0; i < sg.length; i++) {
648        var o = {};
649        for (var x in options) o[x] = options[x];
650        o.slideshowGroup = sg[i];
651        hs.push(hs.slideshows, o);
652      }
653    } else {
654      hs.push(hs.slideshows, options);
655    }
656},
657
658getWrapperKey : function (element, expOnly) {
659    var el, re = /^highslide-wrapper-([0-9]+)$/;
660    // 1. look in open expanders
661    el = element;
662    while (el.parentNode)  {
663      if (el.hsKey !== undefined) return el.hsKey;
664      if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
665      el = el.parentNode;
666    }
667    // 2. look in thumbnail
668    if (!expOnly) {
669      el = element;
670      while (el.parentNode)  {
671        if (el.tagName && hs.isHsAnchor(el)) {
672          for (var key = 0; key < hs.expanders.length; key++) {
673            var exp = hs.expanders[key];
674            if (exp && exp.a == el) return key;
675          }
676        }
677        el = el.parentNode;
678      }
679    }
680    return null; 
681},
682
683getExpander : function (el, expOnly) {
684    if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
685    if (typeof el == 'number') return hs.expanders[el] || null;
686    if (typeof el == 'string') el = hs.$(el);
687    return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
688},
689
690isHsAnchor : function (a) {
691    return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
692},
693
694reOrder : function () {
695    for (var i = 0; i < hs.expanders.length; i++)
696      if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
697},
698fireEvent : function (obj, evt, args) {
699    return obj && obj[evt] ? (obj[evt](obj, args) !== false) : true;
700},
701
702mouseClickHandler : function(e) 
703{  
704    if (!e) e = window.event;
705    if (e.button > 1) return true;
706    if (!e.target) e.target = e.srcElement;
707    
708    var el = e.target;
709    while (el.parentNode
710      && !(/highslide-(image|move|html|resize)/.test(el.className)))
711    {
712      el = el.parentNode;
713    }
714    var exp = hs.getExpander(el);
715    if (exp && (exp.isClosing || !exp.isExpanded)) return true;
716      
717    if (exp && e.type == 'mousedown') {
718      if (e.target.form) return true;
719      var match = el.className.match(/highslide-(image|move|resize)/);
720      if (match) {
721        hs.dragArgs = { 
722          exp: exp , 
723          type: match[1], 
724          left: exp.x.pos, 
725          width: exp.x.size, 
726          top: exp.y.pos, 
727          height: exp.y.size, 
728          clickX: e.clientX, 
729          clickY: e.clientY
730        };
731        
732        
733        hs.addEventListener(document, 'mousemove', hs.dragHandler);
734        if (e.preventDefault) e.preventDefault(); // FF
735        
736        if (/highslide-(image|html)-blur/.test(exp.content.className)) {
737          exp.focus();
738          hs.hasFocused = true;
739        }
740        return false;
741      }
742      else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) {
743        exp.focus();
744        exp.doShowHide('hidden');
745      }
746    } else if (e.type == 'mouseup') {
747      
748      hs.removeEventListener(document, 'mousemove', hs.dragHandler);
749      
750      if (hs.dragArgs) {
751        if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 
752          hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
753        var hasDragged = hs.dragArgs.hasDragged;
754        
755        if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
756          if (hs.fireEvent(exp, 'onImageClick'))
757          exp.close();
758        } 
759        else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
760          hs.dragArgs.exp.doShowHide('hidden');
761        }
762        
763        if (hs.dragArgs.exp.releaseMask) 
764          hs.dragArgs.exp.releaseMask.style.display = 'none';
765        
766        if (hasDragged) hs.fireEvent(hs.dragArgs.exp, 'onDrop', hs.dragArgs);
767        hs.hasFocused = false;
768        hs.dragArgs = null;
769      
770      } else if (/highslide-image-blur/.test(el.className)) {
771        el.style.cursor = hs.styleRestoreCursor;    
772      }
773    }
774    return false;
775},
776
777dragHandler : function(e)
778{
779    if (!hs.dragArgs) return true;
780    if (!e) e = window.event;
781    var a = hs.dragArgs, exp = a.exp;
782    if (exp.iframe) {    
783      if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 
784        { position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 
785          left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4,  background: (hs.ieLt9 ? 'white' : 'none'), 
786          opacity: 0.01 }, 
787        exp.wrapper, true);
788      if (exp.releaseMask.style.display == 'none')
789        exp.releaseMask.style.display = '';
790    }
791    
792    a.dX = e.clientX - a.clickX;
793    a.dY = e.clientY - a.clickY;  
794    
795    var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
796    if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
797      || (distance > (hs.dragSensitivity || 5));
798    
799    if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
800      if (!hs.fireEvent(exp, 'onDrag', a)) return false;
801      
802      if (a.type == 'resize') exp.resize(a);
803      else {
804        exp.moveTo(a.left + a.dX, a.top + a.dY);
805        if (a.type == 'image') exp.content.style.cursor = 'move';
806      }
807    }
808    return false;
809},
810
811wrapperMouseHandler : function (e) {
812    try {
813      if (!e) e = window.event;
814      var over = /mouseover/i.test(e.type); 
815      if (!e.target) e.target = e.srcElement; // ie
816      if (!e.relatedTarget) e.relatedTarget = 
817        over ? e.fromElement : e.toElement; // ie
818      var exp = hs.getExpander(e.target);
819      if (!exp.isExpanded) return;
820      if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 
821        || hs.dragArgs) return;
822      hs.fireEvent(exp, over ? 'onMouseOver' : 'onMouseOut', e);
823      for (var i = 0; i < exp.overlays.length; i++) (function() {
824        var o = hs.$('hsId'+ exp.overlays[i]);
825        if (o && o.hideOnMouseOut) {
826          if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
827          hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
828        }
829      })();  
830    } catch (e) {}
831},
832addEventListener : function (el, event, func) {
833    if (el == document && event == 'ready') {
834      hs.push(hs.onReady, func);
835    }
836    try {
837      el.addEventListener(event, func, false);
838    } catch (e) {
839      try {
840        el.detachEvent('on'+ event, func);
841        el.attachEvent('on'+ event, func);
842      } catch (e) {
843        el['on'+ event] = func;
844      }
845    } 
846},
847
848removeEventListener : function (el, event, func) {
849    try {
850      el.removeEventListener(event, func, false);
851    } catch (e) {
852      try {
853        el.detachEvent('on'+ event, func);
854      } catch (e) {
855        el['on'+ event] = null;
856      }
857    }
858},
859
860preloadFullImage : function (i) {
861    if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
862      var img = document.createElement('img');
863      img.onload = function() { 
864        img = null;
865        hs.preloadFullImage(i + 1);
866      };
867      img.src = hs.preloadTheseImages[i];
868    }
869},
870preloadImages : function (number) {
871    if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
872    
873    var arr = hs.getAnchors();
874    for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
875      hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
876    }
877    
878    // preload outlines
879    if (hs.outlineType)  new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
880    else
881    
882    hs.preloadFullImage(0);
883    
884    // preload cursor
885    if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
886},
887
888
889init : function () {
890    if (!hs.container) {
891    
892      hs.ieLt7 = hs.ie && hs.uaVersion < 7;
893      hs.ieLt9 = hs.ie && hs.uaVersion < 9;
894      
895      hs.getPageSize();
896      hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:';
897      for (var x in hs.langDefaults) {
898        if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
899        else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 
900          hs.lang[x] = hs.langDefaults[x];
901      }
902      
903      hs.container = hs.createElement('div', {
904          className: 'highslide-container'
905        }, {
906          position: 'absolute',
907          left: 0, 
908          top: 0, 
909          width: '100%', 
910          zIndex: hs.zIndexCounter,
911          direction: 'ltr'
912        }, 
913        document.body,
914        true
915      );
916      hs.loading = hs.createElement('a', {
917          className: 'highslide-loading',
918          title: hs.lang.loadingTitle,
919          innerHTML: hs.lang.loadingText,
920          href: 'javascript:;'
921        }, {
922          position: 'absolute',
923          top: '-9999px',
924          opacity: hs.loadingOpacity,
925          zIndex: 1
926        }, hs.container
927      );
928      hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
929      hs.viewport = hs.createElement('div', {
930          className: 'highslide-viewport highslide-viewport-size'
931        }, {
932          visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden'
933        }, hs.container, 1
934      );
935      hs.clearing = hs.createElement('div', null, 
936        { clear: 'both', paddingTop: '1px' }, null, true);
937      
938      // http://www.robertpenner.com/easing/ 
939      Math.linearTween = function (t, b, c, d) {
940        return c*t/d + b;
941      };
942      Math.easeInQuad = function (t, b, c, d) {
943        return c*(t/=d)*t + b;
944      };
945      Math.easeOutQuad = function (t, b, c, d) {
946        return -c *(t/=d)*(t-2) + b;
947      };
948      
949      hs.hideSelects = hs.ieLt7;
950      hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 
951        || (hs.ieLt7 && hs.uaVersion < 5.5));
952      hs.fireEvent(this, 'onActivate');
953    }
954},
955ready : function() {
956    if (hs.isReady) return;
957    hs.isReady = true;
958    for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
959},
960
961updateAnchors : function() {
962    var el, els, all = [], images = [], htmls = [],groups = {}, re;
963      
964    for (var i = 0; i < hs.openerTagNames.length; i++) {
965      els = document.getElementsByTagName(hs.openerTagNames[i]);
966      for (var j = 0; j < els.length; j++) {
967        el = els[j];
968        re = hs.isHsAnchor(el);
969        if (re) {
970          hs.push(all, el);
971          if (re[0] == 'hs.expand') hs.push(images, el);
972          else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el);
973          var g = hs.getParam(el, 'slideshowGroup') || 'none';
974          if (!groups[g]) groups[g] = [];
975          hs.push(groups[g], el);
976        }
977      }
978    }
979    hs.anchors = { all: all, groups: groups, images: images, htmls: htmls };
980    return hs.anchors;
981    
982},
983
984getAnchors : function() {
985    return hs.anchors || hs.updateAnchors();
986},
987
988
989close : function(el) {
990    var exp = hs.getExpander(el);
991    if (exp) exp.close();
992    return false;
993}
994}; // end hs object
995hs.fx = function( elem, options, prop ){
996    this.options = options;
997    this.elem = elem;
998    this.prop = prop;
999
1000    if (!options.orig) options.orig = {};
1001};
1002hs.fx.prototype = {
1003    update: function(){
1004      (hs.fx.step[this.prop] || hs.fx.step._default)(this);
1005      
1006      if (this.options.step)
1007        this.options.step.call(this.elem, this.now, this);
1008
1009    },
1010    custom: function(from, to, unit){
1011      this.startTime = (new Date()).getTime();
1012      this.start = from;
1013      this.end = to;
1014      this.unit = unit;// || this.unit || "px";
1015      this.now = this.start;
1016      this.pos = this.state = 0;
1017
1018      var self = this;
1019      function t(gotoEnd){
1020        return self.step(gotoEnd);
1021      }
1022
1023      t.elem = this.elem;
1024
1025      if ( t() && hs.timers.push(t) == 1 ) {
1026        hs.timerId = setInterval(function(){
1027          var timers = hs.timers;
1028
1029          for ( var i = 0; i < timers.length; i++ )
1030            if ( !timers[i]() )
1031              timers.splice(i--, 1);
1032
1033          if ( !timers.length ) {
1034            clearInterval(hs.timerId);
1035          }
1036        }, 13);
1037      }
1038    },
1039    step: function(gotoEnd){
1040      var t = (new Date()).getTime();
1041      if ( gotoEnd || t >= this.options.duration + this.startTime ) {
1042        this.now = this.end;
1043        this.pos = this.state = 1;
1044        this.update();
1045
1046        this.options.curAnim[ this.prop ] = true;
1047
1048        var done = true;
1049        for ( var i in this.options.curAnim )
1050          if ( this.options.curAnim[i] !== true )
1051            done = false;
1052
1053        if ( done ) {
1054          if (this.options.complete) this.options.complete.call(this.elem);
1055        }
1056        return false;
1057      } else {
1058        var n = t - this.startTime;
1059        this.state = n / this.options.duration;
1060        this.pos = this.options.easing(n, 0, 1, this.options.duration);
1061        this.now = this.start + ((this.end - this.start) * this.pos);
1062        this.update();
1063      }
1064      return true;
1065    }
1066
1067};
1068
1069hs.extend( hs.fx, {
1070    step: {
1071
1072      opacity: function(fx){
1073        hs.setStyles(fx.elem, { opacity: fx.now });
1074      },
1075
1076      _default: function(fx){
1077        try {
1078          if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
1079            fx.elem.style[ fx.prop ] = fx.now + fx.unit;
1080          else
1081            fx.elem[ fx.prop ] = fx.now;
1082        } catch (e) {}
1083      }
1084    }
1085});
1086
1087hs.Outline =  function (outlineType, onLoad) {
1088    this.onLoad = onLoad;
1089    this.outlineType = outlineType;
1090    var v = hs.uaVersion, tr;
1091    
1092    this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
1093    if (!outlineType) {
1094      if (onLoad) onLoad();
1095      return;
1096    }
1097    
1098    hs.init();
1099    this.table = hs.createElement(
1100      'table', { 
1101        cellSpacing: 0 
1102      }, {
1103        visibility: 'hidden',
1104        position: 'absolute',
1105        borderCollapse: 'collapse',
1106        width: 0
1107      },
1108      hs.container,
1109      true
1110    );
1111    var tbody = hs.createElement('tbody', null, null, this.table, 1);
1112    
1113    this.td = [];
1114    for (var i = 0; i <= 8; i++) {
1115      if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
1116      this.td[i] = hs.createElement('td', null, null, tr, true);
1117      var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
1118      hs.setStyles(this.td[i], style);
1119    }
1120    this.td[4].className = outlineType +' highslide-outline';
1121    
1122    this.preloadGraphic(); 
1123};
1124
1125hs.Outline.prototype = {
1126preloadGraphic : function () {
1127    var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
1128          
1129    var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
1130    this.graphic = hs.createElement('img', null, { position: 'absolute', 
1131      top: '-9999px' }, appendTo, true); // for onload trigger
1132    
1133    var pThis = this;
1134    this.graphic.onload = function() { pThis.onGraphicLoad(); };
1135    
1136    this.graphic.src = src;
1137},
1138
1139onGraphicLoad : function () {
1140    var o = this.offset = this.graphic.width / 4,
1141      pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
1142      dim = { height: (2*o) +'px', width: (2*o) +'px' };
1143    for (var i = 0; i <= 8; i++) {
1144      if (pos[i]) {
1145        if (this.hasAlphaImageLoader) {
1146          var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
1147          var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
1148          hs.createElement ('div', null, { 
1149              filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 
1150              position: 'absolute',
1151              width: w, 
1152              height: this.graphic.height +'px',
1153              left: (pos[i][0]*o)+'px',
1154              top: (pos[i][1]*o)+'px'
1155            }, 
1156          div,
1157          true);
1158        } else {
1159          hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
1160        }
1161        
1162        if (window.opera && (i == 3 || i ==5)) 
1163          hs.createElement('div', null, dim, this.td[i], true);
1164        
1165        hs.setStyles (this.td[i], dim);
1166      }
1167    }
1168    this.graphic = null;
1169    if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
1170    hs.pendingOutlines[this.outlineType] = this;
1171    if (this.onLoad) this.onLoad();
1172},
1173    
1174setPosition : function (pos, offset, vis, dur, easing) {
1175    var exp = this.exp,
1176      stl = exp.wrapper.style,
1177      offset = offset || 0,
1178      pos = pos || {
1179        x: exp.x.pos + offset,
1180        y: exp.y.pos + offset,
1181        w: exp.x.get('wsize') - 2 * offset,
1182        h: exp.y.get('wsize') - 2 * offset
1183      };
1184    if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 
1185      ? 'visible' : 'hidden';
1186    hs.setStyles(this.table, {
1187      left: (pos.x - this.offset) +'px',
1188      top: (pos.y - this.offset) +'px',
1189      width: (pos.w + 2 * this.offset) +'px'
1190    });
1191    
1192    pos.w -= 2 * this.offset;
1193    pos.h -= 2 * this.offset;
1194    hs.setStyles (this.td[4], {
1195      width: pos.w >= 0 ? pos.w +'px' : 0,
1196      height: pos.h >= 0 ? pos.h +'px' : 0
1197    });
1198    if (this.hasAlphaImageLoader) this.td[3].style.height 
1199      = this.td[5].style.height = this.td[4].style.height;  
1200    
1201},
1202    
1203destroy : function(hide) {
1204    if (hide) this.table.style.visibility = 'hidden';
1205    else hs.discardElement(this.table);
1206}
1207};
1208
1209hs.Dimension = function(exp, dim) {
1210    this.exp = exp;
1211    this.dim = dim;
1212    this.ucwh = dim == 'x' ? 'Width' : 'Height';
1213    this.wh = this.ucwh.toLowerCase();
1214    this.uclt = dim == 'x' ? 'Left' : 'Top';
1215    this.lt = this.uclt.toLowerCase();
1216    this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
1217    this.rb = this.ucrb.toLowerCase();
1218    this.p1 = this.p2 = 0;
1219};
1220hs.Dimension.prototype = {
1221get : function(key) {
1222    switch (key) {
1223      case 'loadingPos':
1224        return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
1225      case 'loadingPosXfade':
1226        return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2;
1227      case 'wsize':
1228        return this.size + 2 * this.cb + this.p1 + this.p2;
1229      case 'fitsize':
1230        return this.clientSize - this.marginMin - this.marginMax;
1231      case 'maxsize':
1232        return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
1233      case 'opos':
1234        return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
1235      case 'osize':
1236        return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
1237      case 'imgPad':
1238        return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
1239      
1240    }
1241},
1242calcBorders: function() {
1243    // correct for borders
1244    this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
1245    
1246    this.marginMax = hs['margin'+ this.ucrb];
1247},
1248calcThumb: function() {
1249    this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 
1250      this.exp.el['offset'+ this.ucwh];
1251    this.tpos = this.exp.tpos[this.dim];
1252    this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
1253    if (this.tpos == 0 || this.tpos == -1) {
1254      this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];    
1255    };
1256},
1257calcExpanded: function() {
1258    var exp = this.exp;
1259    this.justify = 'auto';
1260    
1261    // get alignment
1262    if (exp.align == 'center') this.justify = 'center';
1263    else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null;
1264    else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max';
1265    
1266    
1267    // size and position
1268    this.pos = this.tpos - this.cb + this.tb;
1269    
1270    if (this.maxHeight && this.dim == 'x')
1271      exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full); 
1272      
1273    this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
1274    this.minSize = exp.allowSizeReduction ? 
1275      Math.min(exp['min'+ this.ucwh], this.full) :this.full;
1276    if (exp.isImage && exp.useBox)  {
1277      this.size = exp[this.wh];
1278      this.imgSize = this.full;
1279    }
1280    if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
1281    this.target = exp['target'+ this.dim.toUpperCase()];
1282    this.marginMin = hs['margin'+ this.uclt];
1283    this.scroll = hs.page['scroll'+ this.uclt];
1284    this.clientSize = hs.page[this.wh];
1285},
1286setSize: function(i) {
1287    var exp = this.exp;
1288    if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
1289      this.imgSize = i;
1290      this.size = Math.max(this.size, this.imgSize);
1291      exp.content.style[this.lt] = this.get('imgPad')+'px';
1292    } else
1293    this.size = i;
1294    
1295    exp.content.style[this.wh] = i +'px';
1296    exp.wrapper.style[this.wh] = this.get('wsize') +'px';
1297    if (exp.outline) exp.outline.setPosition();
1298    if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px';
1299    if (this.dim == 'y' && exp.iDoc && exp.body.style.height != 'auto') try {
1300      exp.iDoc.body.style.overflow = 'auto';
1301    } catch (e) {}
1302    if (exp.isHtml) {
1303      var d = exp.scrollerDiv;
1304      if (this.sizeDiff === undefined)
1305        this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh];
1306      d.style[this.wh] = (this.size - this.sizeDiff) +'px';
1307        
1308      if (this.dim == 'x') exp.mediumContent.style.width = 'auto';
1309      if (exp.body) exp.body.style[this.wh] = 'auto';
1310    }
1311    if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
1312    if (this.dim == 'x' && exp.slideshow && exp.isImage) {
1313      if (i == this.full) exp.slideshow.disable('full-expand');
1314      else exp.slideshow.enable('full-expand');
1315    }
1316},
1317setPos: function(i) {
1318    this.pos = i;
1319    this.exp.wrapper.style[this.lt] = i +'px';  
1320    
1321    if (this.exp.outline) this.exp.outline.setPosition();
1322    
1323}
1324};
1325
1326hs.Expander = function(a, params, custom, contentType) {
1327    if (document.readyState && hs.ie && !hs.isReady) {
1328      hs.addEventListener(document, 'ready', function() {
1329        new hs.Expander(a, params, custom, contentType);
1330      });
1331      return;
1332    } 
1333    this.a = a;
1334    this.custom = custom;
1335    this.contentType = contentType || 'image';
1336    this.isHtml = (contentType == 'html');
1337    this.isImage = !this.isHtml;
1338    
1339    hs.continuePreloading = false;
1340    this.overlays = [];
1341    this.last = hs.last;
1342    hs.last = null;
1343    hs.init();
1344    var key = this.key = hs.expanders.length;
1345    // override inline parameters
1346    for (var i = 0; i < hs.overrides.length; i++) {
1347      var name = hs.overrides[i];
1348      this[name] = params && typeof params[name] != 'undefined' ?
1349        params[name] : hs[name];
1350    }
1351    if (!this.src) this.src = a.href;
1352    
1353    // get thumb
1354    var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
1355    el = this.thumb = el.getElementsByTagName('img')[0] || el;
1356    this.thumbsUserSetId = el.id || a.id;
1357    if (!hs.fireEvent(this, 'onInit')) return true;
1358    
1359    // check if already open
1360    for (var i = 0; i < hs.expanders.length; i++) {
1361      if (hs.expanders[i] && hs.expanders[i].a == a 
1362        && !(this.last && this.transitions[1] == 'crossfade')) {
1363        hs.expanders[i].focus();
1364        return false;
1365      }
1366    }  
1367
1368    // cancel other
1369    if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
1370      if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
1371        hs.expanders[i].cancelLoading();
1372      }
1373    }
1374    hs.expanders[key] = this;
1375    if (!hs.allowMultipleInstances && !hs.upcoming) {
1376      if (hs.expanders[key-1]) hs.expanders[key-1].close();
1377      if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
1378        hs.expanders[hs.focusKey].close();
1379    }
1380    
1381    // initiate metrics
1382    this.el = el;
1383    this.tpos = this.pageOrigin || hs.getPosition(el);
1384    hs.getPageSize();
1385    var x = this.x = new hs.Dimension(this, 'x');
1386    x.calcThumb();
1387    var y = this.y = new hs.Dimension(this, 'y');
1388    y.calcThumb();
1389    if (/area/i.test(el.tagName)) this.getImageMapAreaCorrection(el);
1390    this.wrapper = hs.createElement(
1391      'div', {
1392        id: 'highslide-wrapper-'+ this.key,
1393        className: 'highslide-wrapper '+ this.wrapperClassName
1394      }, {
1395        visibility: 'hidden',
1396        position: 'absolute',
1397        zIndex: hs.zIndexCounter += 2
1398      }, null, true );
1399    
1400    this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
1401    if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
1402      this.outlineWhileAnimating = 0;
1403    
1404    // get the outline
1405    if (!this.outlineType 
1406      || (this.last && this.isImage && this.transitions[1] == 'crossfade')) {
1407      this[this.contentType +'Create']();
1408    
1409    } else if (hs.pendingOutlines[this.outlineType]) {
1410      this.connectOutline();
1411      this[this.contentType +'Create']();
1412    
1413    } else {
1414      this.showLoading();
1415      var exp = this;
1416      new hs.Outline(this.outlineType, 
1417        function () {
1418          exp.connectOutline();
1419          exp[exp.contentType +'Create']();
1420        } 
1421      );
1422    }
1423    return true;
1424};
1425
1426hs.Expander.prototype = {
1427error : function(e) {
1428    if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message);
1429    else window.location.href = this.src;
1430},
1431
1432connectOutline : function() {
1433    var outline = this.outline = hs.pendingOutlines[this.outlineType];
1434    outline.exp = this;
1435    outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
1436    hs.pendingOutlines[this.outlineType] = null;
1437},
1438
1439showLoading : function() {
1440    if (this.onLoadStarted || this.loading) return;
1441    
1442    this.loading = hs.loading;
1443    var exp = this;
1444    this.loading.onclick = function() {
1445      exp.cancelLoading();
1446    };
1447    
1448    
1449    if (!hs.fireEvent(this, 'onShowLoading')) return;
1450    var exp = this, 
1451      l = this.x.get('loadingPos') +'px',
1452      t = this.y.get('loadingPos') +'px';
1453    if (!tgt && this.last && this.transitions[1] == 'crossfade') 
1454      var tgt = this.last; 
1455    if (tgt) {
1456      l = tgt.x.get('loadingPosXfade') +'px';
1457      t = tgt.y.get('loadingPosXfade') +'px';
1458      this.loading.style.zIndex = hs.zIndexCounter++;
1459    }
1460    setTimeout(function () { 
1461      if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
1462    , 100);
1463},
1464
1465imageCreate : function() {
1466    var exp = this;
1467    
1468    var img = document.createElement('img');
1469this.content = img;
1470img.onload = function () {
1471    if (hs.expanders[exp.key]) exp.contentLoaded(); 
1472    };
1473if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
1474img.className = 'highslide-image';
1475hs.setStyles(img, {
1476    visibility: 'hidden',
1477    display: 'block',
1478    position: 'absolute',
1479      maxWidth: '9999px',
1480      zIndex: 3
1481    });
1482img.title = hs.lang.restoreTitle;
1483    if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
1484if (hs.ie && hs.flushImgSize) img.src = null;
1485    img.src = this.src;
1486    
1487    this.showLoading();
1488},
1489
1490htmlCreate : function () {
1491    if (!hs.fireEvent(this, 'onBeforeGetContent')) return;
1492    
1493    this.content = hs.getCacheBinding(this.a);
1494    if (!this.content) 
1495      this.content = hs.getNode(this.contentId);
1496    if (!this.content) 
1497      this.content = hs.getSelfRendered();
1498    this.getInline(['maincontent']);
1499    if (this.maincontent) {
1500      var body = hs.getElementByClass(this.content, 'div', 'highslide-body');
1501      if (body) body.appendChild(this.maincontent);
1502      this.maincontent.style.display = 'block';
1503    }
1504    hs.fireEvent(this, 'onAfterGetContent');
1505    
1506    var innerContent = this.innerContent = this.content;
1507    
1508    if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(innerContent);
1509    
1510    // the content tree
1511    hs.container.appendChild(this.wrapper);
1512    hs.setStyles( this.wrapper, { 
1513      position: 'static',
1514      padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px'
1515    });
1516    this.content = hs.createElement(
1517    'div', {
1518      className: 'highslide-html' 
1519    }, {
1520        position: 'relative',
1521        zIndex: 3,
1522        height: 0,
1523        overflow: 'hidden'
1524      },
1525      this.wrapper
1526    );
1527    this.mediumContent = hs.createElement('div', null, null, this.content, 1);
1528    this.mediumContent.appendChild(innerContent);
1529    
1530    hs.setStyles (innerContent, { 
1531      position: 'relative',
1532      display: 'block',
1533      direction: hs.lang.cssDirection || ''
1534    });
1535    if (this.width) innerContent.style.width = this.width +'px';
1536    if (this.height) hs.setStyles(innerContent, {
1537      height: this.height +'px',
1538      overflow: 'hidden'
1539    });
1540    if (innerContent.offsetWidth < this.minWidth)
1541      innerContent.style.width = this.minWidth +'px';
1542      
1543    
1544
1545    if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) {
1546      this.showLoading();
1547    var exp = this;
1548    var ajax = new hs.Ajax(this.a, this.innerContent);
1549      ajax.src = this.src;
1550    ajax.onLoad = function () {  if (hs.expanders[exp.key]) exp.contentLoaded(); };
1551    ajax.onError = function () { location.href = exp.src; };
1552    ajax.run();
1553    }
1554else
1555
1556if (this.objectType == 'iframe' && this.objectLoadTime == 'before') {
1557      this.writeExtendedContent();
1558    }
1559else
1560    this.contentLoaded();
1561},
1562
1563contentLoaded : function() {
1564    try {  
1565      if (!this.content) return;
1566      this.content.onload = null;
1567      if (this.onLoadStarted) return;
1568      else this.onLoadStarted = true;
1569      
1570      var x = this.x, y = this.y;
1571      
1572      if (this.loading) {
1573        hs.setStyles(this.loading, { top: '-9999px' });
1574        this.loading = null;
1575        hs.fireEvent(this, 'onHideLoading');
1576      }
1577      if (this.isImage) {  
1578        x.full = this.content.width;
1579        y.full = this.content.height;
1580        
1581        hs.setStyles(this.content, {
1582          width: x.t +'px',
1583          height: y.t +'px'
1584        });
1585        this.wrapper.appendChild(this.content);
1586        hs.container.appendChild(this.wrapper);
1587      } else if (this.htmlGetSize) this.htmlGetSize();
1588      
1589      x.calcBorders();
1590      y.calcBorders();
1591      
1592      hs.setStyles (this.wrapper, {
1593        left: (x.tpos + x.tb - x.cb) +'px',
1594        top: (y.tpos + x.tb - y.cb) +'px'
1595      });
1596      
1597      
1598      this.initSlideshow();
1599      this.getOverlays();
1600      
1601      var ratio = x.full / y.full;
1602      x.calcExpanded();
1603      this.justify(x);
1604      
1605      y.calcExpanded();
1606      this.justify(y);
1607      if (this.isHtml) this.htmlSizeOperations();
1608      if (this.overlayBox) this.sizeOverlayBox(0, 1);
1609
1610      
1611      if (this.allowSizeReduction) {
1612        if (this.isImage)
1613          this.correctRatio(ratio);
1614        else this.fitOverlayBox();
1615        var ss = this.slideshow;      
1616        if (ss && this.last && ss.controls && ss.fixedControls) {
1617          var pos = ss.overlayOptions.position || '', p;
1618          for (var dim in hs.oPos) for (var i = 0; i < 5; i++) {
1619            p = this[dim];
1620            if (pos.match(hs.oPos[dim][i])) {
1621              p.pos = this.last[dim].pos 
1622                + (this.last[dim].p1 - p.p1)
1623                + (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i];
1624              if (ss.fixedControls == 'fit') {
1625                if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
1626                  p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2;
1627                if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin; 
1628              } 
1629            }
1630          }
1631        }
1632        if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
1633          this.createFullExpand();
1634          if (this.overlays.length == 1) this.sizeOverlayBox();
1635        }
1636      }
1637      this.show();
1638      
1639    } catch (e) {
1640      this.error(e);
1641    }
1642},
1643
1644
1645setObjContainerSize : function(parent, auto) {
1646    var c = hs.getElementByClass(parent, 'DIV', 'highslide-body');
1647    if (/(iframe|swf)/.test(this.objectType)) {
1648      if (this.objectWidth) c.style.width = this.objectWidth +'px';
1649      if (this.objectHeight) c.style.height = this.objectHeight +'px';
1650    }
1651},
1652
1653writeExtendedContent : function () {
1654    if (this.hasExtendedContent) return;
1655    var exp = this;
1656    this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
1657    if (this.objectType == 'iframe') {
1658      this.showLoading();
1659      var ruler = hs.clearing.cloneNode(1);
1660      this.body.appendChild(ruler);
1661      this.newWidth = this.innerContent.offsetWidth;
1662      if (!this.objectWidth) this.objectWidth = ruler.offsetWidth;
1663      var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight,
1664        h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom,
1665        onload = this.objectLoadTime == 'before' ? 
1666          ' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : '';
1667      this.body.innerHTML += '<iframe allowfullscreen webkitallowfullscreen mozallowfullscreen name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" '
1668        +' style="width:'+ this.objectWidth +'px; height:'+ h +'px" '
1669        + onload +' src="'+ this.src +'" ></iframe>';
1670      this.ruler = this.body.getElementsByTagName('div')[0];
1671      this.iframe = this.body.getElementsByTagName('iframe')[0];
1672      
1673      if (this.objectLoadTime == 'after') this.correctIframeSize();
1674      
1675    }
1676    if (this.objectType == 'swf') {
1677      this.body.id = this.body.id || 'hs-flash-id-' + this.key;
1678      var a = this.swfOptions;
1679      if (!a.params) a.params = {};
1680      if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent';
1681      if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 
1682        a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes);
1683    }
1684    this.hasExtendedContent = true;
1685},
1686htmlGetSize : function() {
1687    if (this.iframe && !this.objectHeight) { // loadtime before
1688      this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px';
1689    }
1690    this.innerContent.appendChild(hs.clearing);
1691    if (!this.x.full) this.x.full = this.innerContent.offsetWidth;
1692this.y.full = this.innerContent.offsetHeight;
1693this.innerContent.removeChild(hs.clearing);
1694if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug
1695      this.newHeight = parseInt(this.innerContent.currentStyle.height);
1696    }
1697    hs.setStyles( this.wrapper, { position: 'absolute',  padding: '0'});
1698    hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'});
1699    
1700},
1701
1702getIframePageHeight : function() {
1703    var h;
1704    try {
1705      var doc = this.iDoc = this.iframe.contentDocument || this.iframe.contentWindow.document;
1706      var clearing = doc.createElement('div');
1707      clearing.style.clear = 'both';
1708      doc.body.appendChild(clearing);
1709      h = clearing.offsetTop;
1710      if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 
1711        + parseInt(doc.body.currentStyle.marginBottom) - 1;
1712    } catch (e) { // other domain
1713      h = 300;
1714    }
1715    return h;
1716},
1717correctIframeSize : function () {
1718    var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth;
1719    hs.discardElement(this.ruler);
1720    if (wDiff < 0) wDiff = 0;
1721    
1722    var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight;
1723    if (this.iDoc && !this.objectHeight && !this.height && this.y.size == this.y.full) try {
1724      this.iDoc.body.style.overflow = 'hidden';
1725    } catch (e) {}
1726    hs.setStyles(this.iframe, { 
1727      width: Math.abs(this.x.size - wDiff) +'px', 
1728      height: Math.abs(this.y.size - hDiff) +'px'
1729    });
1730hs.setStyles(this.body, { 
1731      width: this.iframe.style.width, 
1732    height: this.iframe.style.height
1733    });
1734    
1735this.scrollingContent = this.iframe;
1736this.scrollerDiv = this.scrollingContent;
1737    
1738},
1739htmlSizeOperations : function () {
1740    
1741    this.setObjContainerSize(this.innerContent);
1742    
1743    
1744    if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeExtendedContent();  
1745    
1746// handle minimum size
1747if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full;
1748if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full;
1749    this.scrollerDiv = this.innerContent;
1750hs.setStyles(this.mediumContent, { 
1751      position: 'relative',
1752      width: this.x.size +'px'
1753    });
1754hs.setStyles(this.innerContent, { 
1755    border: 'none',
1756    width: 'auto',
1757    height: 'auto'
1758});
1759    var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
1760if (node && !/(iframe|swf)/.test(this.objectType)) {
1761    var cNode = node; // wrap to get true size
1762    node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true);
1763    cNode.parentNode.insertBefore(node, cNode);
1764    node.appendChild(hs.clearing); // IE6
1765    node.appendChild(cNode);
1766    
1767    var wDiff = this.innerContent.offsetWidth - node.offsetWidth;
1768    var hDiff = this.innerContent.offsetHeight - node.offsetHeight;
1769      node.removeChild(hs.clearing);
1770    
1771    var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug
1772    hs.setStyles(node, { 
1773        width: (this.x.size - wDiff - kdeBugCorr) +'px', 
1774        height: (this.y.size - hDiff) +'px',
1775        overflow: 'auto', 
1776        position: 'relative' 
1777      } 
1778    );
1779      if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight)  {
1780      node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px';
1781      }
1782    this.scrollingContent = node;
1783    this.scrollerDiv = this.scrollingContent;
1784    }
1785if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize();
1786if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content;
1787    
1788    if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) {
1789      this.x.size += 17; // room for scrollbars
1790    }
1791    if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) {
1792      setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}",
1793         hs.expandDuration);
1794    }
1795},
1796
1797getImageMapAreaCorrection : function(area) {
1798    var c = area.coords.split(',');
1799    for (var i = 0; i < c.length; i++) c[i] = parseInt(c[i]);
1800    
1801    if (area.shape.toLowerCase() == 'circle') {
1802      this.x.tpos += c[0] - c[2];
1803      this.y.tpos += c[1] - c[2];
1804      this.x.t = this.y.t = 2 * c[2];
1805    } else {
1806      var maxX, maxY, minX = maxX = c[0], minY = maxY = c[1];
1807      for (var i = 0; i < c.length; i++) {
1808        if (i % 2 == 0) {
1809          minX = Math.min(minX, c[i]);
1810          maxX = Math.max(maxX, c[i]);
1811        } else {
1812          minY = Math.min(minY, c[i]);
1813          maxY = Math.max(maxY, c[i]);
1814        }
1815      }
1816      this.x.tpos += minX;
1817      this.x.t = maxX - minX;
1818      this.y.tpos += minY;
1819      this.y.t = maxY - minY;
1820    }
1821},
1822justify : function (p, moveOnly) {
1823    var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
1824    
1825    if (tgt && tgt.match(/ /)) {
1826      tgtArr = tgt.split(' ');
1827      tgt = tgtArr[0];
1828    }
1829    if (tgt && hs.$(tgt)) {
1830      p.pos = hs.getPosition(hs.$(tgt))[dim];
1831      if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/)) 
1832        p.pos += parseInt(tgtArr[1]);
1833      if (p.size < p.minSize) p.size = p.minSize;
1834      
1835    } else if (p.justify == 'auto' || p.justify == 'center') {
1836    
1837      var hasMovedMin = false;
1838      
1839      var allowReduce = p.exp.allowSizeReduction;
1840      if (p.justify == 'center')
1841        p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2);
1842      else
1843        p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
1844      if (p.pos < p.scroll + p.marginMin) {
1845        p.pos = p.scroll + p.marginMin;
1846        hasMovedMin = true;    
1847      }
1848      if (!moveOnly && p.size < p.minSize) {
1849        p.size = p.minSize;
1850        allowReduce = false;
1851      }
1852      if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
1853        if (!moveOnly && hasMovedMin && allowReduce) {
1854          p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize'));
1855        } else if (p.get('wsize') < p.get('fitsize')) {
1856          p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
1857        } else { // image larger than viewport
1858          p.pos = p.scroll + p.marginMin;
1859          if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
1860        }      
1861      }
1862      
1863      if (!moveOnly && p.size < p.minSize) {
1864        p.size = p.minSize;
1865        allowReduce = false;
1866      }
1867      
1868    
1869    } else if (p.justify == 'max') {
1870      p.pos = Math.floor(p.pos - p.size + p.t);
1871    }
1872    
1873      
1874    if (p.pos < p.marginMin) {
1875      var tmpMin = p.pos;
1876      p.pos = p.marginMin; 
1877      
1878      if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
1879      
1880    }
1881},
1882
1883correctRatio : function(ratio) {
1884    var x = this.x, 
1885      y = this.y,
1886      changed = false,
1887      xSize = Math.min(x.full, x.size),
1888      ySize = Math.min(y.full, y.size),
1889      useBox = (this.useBox || hs.padToMinWidth);
1890    
1891    if (xSize / ySize > ratio) { // width greater
1892      xSize = ySize * ratio;
1893      if (xSize < x.minSize) { // below minWidth
1894        xSize = x.minSize;
1895        ySize = xSize / ratio;
1896      }
1897      changed = true;
1898    
1899    } else if (xSize / ySize < ratio) { // height greater
1900      ySize = xSize / ratio;
1901      changed = true;
1902    }
1903    
1904    if (hs.padToMinWidth && x.full < x.minSize) {
1905      x.imgSize = x.full;
1906      y.size = y.imgSize = y.full;
1907    } else if (this.useBox) {
1908      x.imgSize = xSize;
1909      y.imgSize = ySize;
1910    } else {
1911      x.size = xSize;
1912      y.size = ySize;
1913    }
1914    changed = this.fitOverlayBox(this.useBox ? null : ratio, changed);
1915    if (useBox && y.size < y.imgSize) {
1916      y.imgSize = y.size;
1917      x.imgSize = y.size * ratio;
1918    }
1919    if (changed || useBox) {
1920      x.pos = x.tpos - x.cb + x.tb;
1921      x.minSize = x.size;
1922      this.justify(x, true);
1923    
1924      y.pos = y.tpos - y.cb + y.tb;
1925      y.minSize = y.size;
1926      this.justify(y, true);
1927      if (this.overlayBox) this.sizeOverlayBox();
1928    }
1929    
1930    
1931},
1932fitOverlayBox : function(ratio, changed) {
1933    var x = this.x, y = this.y;
1934    if (this.overlayBox && (this.isImage || this.allowHeightReduction)) {
1935      while (y.size > this.minHeight && x.size > this.minWidth 
1936          &&  y.get('wsize') > y.get('fitsize')) {
1937        y.size -= 10;
1938        if (ratio) x.size = y.size * ratio;
1939        this.sizeOverlayBox(0, 1);
1940        changed = true;
1941      }
1942    }
1943    return changed;
1944},
1945
1946reflow : function () {
1947    if (this.scrollerDiv) {
1948      var h = /iframe/i.test(this.scrollerDiv.tagName) ? (this.getIframePageHeight() + 1) +'px' : 'auto';
1949      if (this.body) this.body.style.height = h;
1950      this.scrollerDiv.style.height = h;
1951      this.y.setSize(this.innerContent.offsetHeight);
1952    }
1953},
1954
1955show : function () {
1956    var x = this.x, y = this.y;
1957    this.doShowHide('hidden');
1958    hs.fireEvent(this, 'onBeforeExpand');
1959    if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb();
1960    
1961    // Apply size change
1962    this.changeSize(
1963      1, {
1964        wrapper: {
1965          width : x.get('wsize'),
1966          height : y.get('wsize'),
1967          left: x.pos,
1968          top: y.pos
1969        },
1970        content: {
1971          left: x.p1 + x.get('imgPad'),
1972          top: y.p1 + y.get('imgPad'),
1973          width:x.imgSize ||x.size,
1974          height:y.imgSize ||y.size
1975        }
1976      },
1977      hs.expandDuration
1978    );
1979},
1980
1981changeSize : function(up, to, dur) {
1982    // transition
1983    var trans = this.transitions,
1984    other = up ? (this.last ? this.last.a : null) : hs.upcoming,
1985    t = (trans[1] && other 
1986        && hs.getParam(other, 'transitions')[1] == trans[1]) ?
1987      trans[1] : trans[0];
1988      
1989    if (this[t] && t != 'expand') {
1990      this[t](up, to);
1991      return;
1992    }
1993    
1994    if (this.outline && !this.outlineWhileAnimating) {
1995      if (up) this.outline.setPosition();
1996      else this.outline.destroy(
1997          (this.isHtml && this.preserveContent));
1998    }
1999    
2000    
2001    if (!up) this.destroyOverlays();
2002    
2003    var exp = this,
2004      x = exp.x,
2005      y = exp.y,
2006      easing = this.easing;
2007    if (!up) easing = this.easingClose || easing;
2008    var after = up ?
2009      function() {
2010          
2011        if (exp.outline) exp.outline.table.style.visibility = "visible";
2012        setTimeout(function() {
2013          exp.afterExpand();
2014        }, 50);
2015      } :
2016      function() {
2017        exp.afterClose();
2018      };
2019    if (up) hs.setStyles( this.wrapper, {
2020      width: x.t +'px',
2021      height: y.t +'px'
2022    });
2023    if (up && this.isHtml) {
2024      hs.setStyles(this.wrapper, {
2025        left: (x.tpos - x.cb + x.tb) +'px',
2026        top: (y.tpos - y.cb + y.tb) +'px'
2027      });
2028    }
2029    if (this.fadeInOut) {
2030      hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
2031      hs.extend(to.wrapper, { opacity: up });
2032    }
2033    hs.animate( this.wrapper, to.wrapper, {
2034      duration: dur,
2035      easing: easing,
2036      step: function(val, args) {
2037        if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
2038          var fac = up ? args.pos : 1 - args.pos;
2039          var pos = {
2040            w: x.t + (x.get('wsize') - x.t) * fac,
2041            h: y.t + (y.get('wsize') - y.t) * fac,
2042            x: x.tpos + (x.pos - x.tpos) * fac,
2043            y: y.tpos + (y.pos - y.tpos) * fac
2044          };
2045          exp.outline.setPosition(pos, 0, 1);        
2046        }
2047        if (exp.isHtml) {  
2048          if (args.prop == 'left') 
2049            exp.mediumContent.style.left = (x.pos - val) +'px';
2050          if (args.prop == 'top') 
2051            exp.mediumContent.style.top = (y.pos - val) +'px';
2052        }
2053      }
2054    });
2055    hs.animate( this.content, to.content, dur, easing, after);
2056    if (up) {
2057      this.wrapper.style.visibility = 'visible';
2058      this.content.style.visibility = 'visible';
2059      if (this.isHtml) this.innerContent.style.visibility = 'visible';
2060      this.a.className += ' highslide-active-anchor';
2061    }
2062},
2063
2064
2065
2066fade : function(up, to) {
2067    this.outlineWhileAnimating = false;
2068    var exp = this,  t = up ? hs.expandDuration : 0;
2069    
2070    if (up) {
2071      hs.animate(this.wrapper, to.wrapper, 0);
2072      hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' });
2073      hs.animate(this.content, to.content, 0);
2074      this.content.style.visibility = 'visible';
2075
2076      hs.animate(this.wrapper, { opacity: 1 }, t, null, 
2077        function() { exp.afterExpand(); });
2078    }
2079    
2080    if (this.outline) {
2081      this.outline.table.style.zIndex = this.wrapper.style.zIndex;
2082      var dir = up || -1, 
2083        offset = this.outline.offset,
2084        startOff = up ? 3 : offset,
2085        endOff = up? offset : 3;
2086      for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) {
2087        (function() {
2088          var o = up ? endOff - i : startOff - i;
2089          setTimeout(function() {
2090            exp.outline.setPosition(0, o, 1);
2091          }, t);
2092        })();
2093      }
2094    }
2095    
2096    
2097    if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50);
2098    else {
2099      setTimeout( function() {
2100        if (exp.outline) exp.outline.destroy(exp.preserveContent);
2101        
2102        exp.destroyOverlays();
2103    
2104        hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){
2105          exp.afterClose();
2106        });
2107      }, t);    
2108    }
2109},
2110crossfade : function (up, to, from) {
2111    if (!up) return;
2112    var exp = this, 
2113      last = this.last,
2114      x = this.x,
2115      y = this.y,
2116      lastX = last.x,
2117      lastY = last.y,
2118      wrapper = this.wrapper,
2119      content = this.content,
2120      overlayBox = this.overlayBox;
2121    hs.removeEventListener(document, 'mousemove', hs.dragHandler);
2122    
2123    hs.setStyles(content, { 
2124      width: (x.imgSize || x.size) +'px', 
2125      height: (y.imgSize || y.size) +'px'    
2126    });
2127    if (overlayBox) overlayBox.style.overflow = 'visible';
2128    this.outline = last.outline;
2129    if (this.outline) this.outline.exp = exp;
2130    last.outline = null;
2131    var fadeBox = hs.createElement('div', {
2132        className: 'highslide-'+ this.contentType
2133      }, { 
2134        position: 'absolute', 
2135        zIndex: 4,
2136        overflow: 'hidden',
2137        display: 'none'
2138      }
2139    );
2140    var names = { oldImg: last, newImg: this };
2141    for (var n in names) {   
2142      this[n] = names[n].content.cloneNode(1);
2143      hs.setStyles(this[n], {
2144        position: 'absolute',
2145        border: 0,
2146        visibility: 'visible'
2147      });
2148      fadeBox.appendChild(this[n]);
2149    }
2150    wrapper.appendChild(fadeBox);
2151    if (this.isHtml) hs.setStyles(this.mediumContent, { 
2152      left: 0,
2153      top: 0
2154    });
2155    if (overlayBox) {
2156      overlayBox.className = '';
2157      wrapper.appendChild(overlayBox);
2158    }
2159    fadeBox.style.display = '';
2160    last.content.style.display = 'none';
2161    
2162    
2163    if (hs.safari && hs.uaVersion < 525) {
2164      this.wrapper.style.visibility = 'visible';
2165    }
2166    hs.animate(wrapper, {
2167      width: x.size
2168    }, {
2169      duration: hs.transitionDuration, 
2170      step: function(val, args) {
2171        var pos = args.pos,
2172          invPos = 1 - pos;
2173        var prop,
2174          size = {}, 
2175          props = ['pos', 'size', 'p1', 'p2'];
2176        for (var n in props) {
2177          prop = props[n];
2178          size['x'+ prop] = Math.round(invPos * lastX[prop] + pos * x[prop]);
2179          size['y'+ prop] = Math.round(invPos * lastY[prop] + pos * y[prop]);
2180          size.ximgSize = Math.round(
2181            invPos * (lastX.imgSize || lastX.size) + pos * (x.imgSize || x.size));
2182          size.ximgPad = Math.round(invPos * lastX.get('imgPad') + pos * x.get('imgPad'));
2183          size.yimgSize = Math.round(
2184            invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size));
2185          size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad'));
2186        }
2187        if (exp.outline) exp.outline.setPosition({ 
2188          x: size.xpos, 
2189          y: size.ypos, 
2190          w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb, 
2191          h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb
2192        });
2193        last.wrapper.style.clip = 'rect('
2194          + (size.ypos - lastY.pos)+'px, '
2195          + (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, '
2196          + (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, '
2197          + (size.xpos - lastX.pos)+'px)';
2198          
2199        hs.setStyles(content, {
2200          top: (size.yp1 + y.get('imgPad')) +'px',
2201          left: (size.xp1 + x.get('imgPad')) +'px',
2202          marginTop: (y.pos - size.ypos) +'px',
2203          marginLeft: (x.pos - size.xpos) +'px'
2204        });
2205        hs.setStyles(wrapper, {
2206          top: size.ypos +'px',
2207          left: size.xpos +'px',
2208          width: (size.xp1 + size.xp2 + size.xsize + 2 * x.cb)+ 'px',
2209          height: (size.yp1 + size.yp2 + size.ysize + 2 * y.cb) + 'px'
2210        });
2211        hs.setStyles(fadeBox, {
2212          width: (size.ximgSize || size.xsize) + 'px',
2213          height: (size.yimgSize || size.ysize) +'px',
2214          left: (size.xp1 + size.ximgPad)  +'px',
2215          top: (size.yp1 + size.yimgPad) +'px',
2216          visibility: 'visible'
2217        });
2218        
2219        hs.setStyles(exp.oldImg, {
2220          top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px',
2221          left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px'
2222        });    
2223        
2224        hs.setStyles(exp.newImg, {
2225          opacity: pos,
2226          top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px',
2227          left: (x.pos - size.xpos + x.p1 - size.xp1 + x.get('imgPad') - size.ximgPad) +'px'
2228        });
2229        if (overlayBox) hs.setStyles(overlayBox, {
2230          width: size.xsize + 'px',
2231          height: size.ysize +'px',
2232          left: (size.xp1 + x.cb)  +'px',
2233          top: (size.yp1 + y.cb) +'px'
2234        });
2235      },
2236      complete: function () {
2237        wrapper.style.visibility = content.style.visibility = 'visible';
2238        content.style.display = 'block';
2239        hs.discardElement(fadeBox);
2240        exp.afterExpand();
2241        last.afterClose();
2242        exp.last = null;
2243      }
2244      
2245    });
2246},
2247reuseOverlay : function(o, el) {
2248    if (!this.last) return false;
2249    for (var i = 0; i < this.last.overlays.length; i++) {
2250      var oDiv = hs.$('hsId'+ this.last.overlays[i]);
2251      if (oDiv && oDiv.hsId == o.hsId) {
2252        this.genOverlayBox();
2253        oDiv.reuse = this.key;
2254        hs.push(this.overlays, this.last.overlays[i]);
2255        return true;
2256      }
2257    }
2258    return false;
2259},
2260
2261
2262afterExpand : function() {
2263    this.isExpanded = true;  
2264    this.focus();
2265    
2266    if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent();
2267    if (this.iframe) {
2268      try {
2269        var exp = this,
2270          doc = this.iframe.contentDocument || this.iframe.contentWindow.document;
2271        hs.addEventListener(doc, 'mousedown', function () {
2272          if (hs.focusKey != exp.key) exp.focus();
2273        });
2274      } catch(e) {}
2275      if (hs.ie && typeof this.isClosing != 'boolean') // first open 
2276        this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout
2277    }
2278    if (this.dimmingOpacity) hs.dim(this);
2279    if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
2280    this.prepareNextOutline();
2281    var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
2282    this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
2283      && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');  
2284    if (this.overlayBox) this.showOverlays();
2285    hs.fireEvent(this, 'onAfterExpand');
2286    
2287},
2288
2289
2290prepareNextOutline : function() {
2291    var key = this.key;
2292    var outlineType = this.outlineType;
2293    new hs.Outline(outlineType, 
2294      function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
2295},
2296
2297
2298preloadNext : function() {
2299    var next = this.getAdjacentAnchor(1);
2300    if (next && next.onclick.toString().match(/hs\.expand/)) 
2301      var img = hs.createElement('img', { src: hs.getSrc(next) });
2302},
2303
2304
2305getAdjacentAnchor : function(op) {
2306    var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];
2307    if (as && !as[current + op] && this.slideshow && this.slideshow.repeat) {
2308      if (op == 1) return as[0];
2309      else if (op == -1) return as[as.length-1];
2310    }
2311    return (as && as[current + op]) || null;
2312},
2313
2314getAnchorIndex : function() {
2315    var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
2316    if (arr) for (var i = 0; i < arr.length; i++) {
2317      if (arr[i] == this.a) return i; 
2318    }
2319    return null;
2320},
2321
2322
2323getNumber : function() {
2324    if (this[this.numberPosition]) {
2325      var arr = hs.anchors.groups[this.slideshowGroup || 'none'];
2326      if (arr) {
2327        var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length);
2328        this[this.numberPosition].innerHTML = 
2329          '<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML;
2330      }
2331    }
2332},
2333initSlideshow : function() {
2334    if (!this.last) {
2335      for (var i = 0; i < hs.slideshows.length; i++) {
2336        var ss = hs.slideshows[i], sg = ss.slideshowGroup;
2337        if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup) 
2338          this.slideshow = new hs.Slideshow(this.key, ss);
2339      } 
2340    } else {
2341      this.slideshow = this.last.slideshow;
2342    }
2343    var ss = this.slideshow;
2344    if (!ss) return;
2345    var key = ss.expKey = this.key;
2346    
2347    ss.checkFirstAndLast();
2348    ss.disable('full-expand');
2349    if (ss.controls) {
2350      this.createOverlay(hs.extend(ss.overlayOptions || {}, {
2351        overlayId: ss.controls,
2352        hsId: 'controls',
2353        zIndex: 5
2354      }));
2355    }
2356    if (ss.thumbstrip) ss.thumbstrip.add(this);
2357    if (!this.last && this.autoplay) ss.play(true);
2358    if (ss.autoplay) {
2359      ss.autoplay = setTimeout(function() {
2360        hs.next(key);
2361      }, (ss.interval || 500));
2362    }
2363},
2364
2365cancelLoading : function() {
2366    hs.discardElement (this.wrapper);
2367    hs.expanders[this.key] = null;
2368    if (hs.upcoming == this.a) hs.upcoming = null;
2369    hs.undim(this.key);
2370    if (this.loading) hs.loading.style.left = '-9999px';
2371    hs.fireEvent(this, 'onHideLoading');
2372},
2373
2374writeCredits : function () {
2375    if (this.credits) return;
2376    this.credits = hs.createElement('a', {
2377      href: hs.creditsHref,
2378      target: hs.creditsTarget,
2379      className: 'highslide-credits',
2380      innerHTML: hs.lang.creditsText,
2381      title: hs.lang.creditsTitle
2382    });
2383    this.createOverlay({ 
2384      overlayId: this.credits, 
2385      position: this.creditsPosition || 'top left', 
2386      hsId: 'credits' 
2387    });
2388},
2389
2390getInline : function(types, addOverlay) {
2391    for (var i = 0; i < types.length; i++) {
2392      var type = types[i], s = null;
2393      if (type == 'caption' && !hs.fireEvent(this, 'onBeforeGetCaption')) return;
2394      else if (type == 'heading' && !hs.fireEvent(this, 'onBeforeGetHeading')) return;
2395      if (!this[type +'Id'] && this.thumbsUserSetId)  
2396        this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
2397      if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
2398      if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
2399        s = eval(this[type +'Eval']);
2400      } catch (e) {}
2401      if (!this[type] && this[type +'Text']) {
2402        s = this[type +'Text'];
2403      }
2404      if (!this[type] && !s) {
2405        this[type] = hs.getNode(this.a['_'+ type + 'Id']);
2406        if (!this[type]) {
2407          var next = this.a.nextSibling;
2408          while (next && !hs.isHsAnchor(next)) {
2409            if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
2410              if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++;
2411              this[type] = hs.getNode(next.id);
2412              break;
2413            }
2414            next = next.nextSibling;
2415          }
2416        }
2417      }
2418      if (!this[type] && !s && this.numberPosition == type) s = '\n';
2419      
2420      if (!this[type] && s) this[type] = hs.createElement('div', 
2421          { className: 'highslide-'+ type, innerHTML: s } );
2422      
2423      if (addOverlay && this[type]) {
2424        var o = { position: (type == 'heading') ? 'above' : 'below' };
2425        for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
2426        o.overlayId = this[type];
2427        this.createOverlay(o);
2428      }
2429    }
2430},
2431
2432
2433// on end move and resize
2434doShowHide : function(visibility) {
2435    if (hs.hideSelects) this.showHideElements('SELECT', visibility);
2436    if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
2437    if (hs.geckoMac) this.showHideElements('*', visibility);
2438},
2439showHideElements : function (tagName, visibility) {
2440    var els = document.getElementsByTagName(tagName);
2441    var prop = tagName == '*' ? 'overflow' : 'visibility';
2442    for (var i = 0; i < els.length; i++) {
2443      if (prop == 'visibility' || (document.defaultView.getComputedStyle(
2444          els[i], "").getPropertyValue('overflow') == 'auto'
2445          || els[i].getAttribute('hidden-by') != null)) {
2446        var hiddenBy = els[i].getAttribute('hidden-by');
2447        if (visibility == 'visible' && hiddenBy) {
2448          hiddenBy = hiddenBy.replace('['+ this.key +']', '');
2449          els[i].setAttribute('hidden-by', hiddenBy);
2450          if (!hiddenBy) els[i].style[prop] = els[i].origProp;
2451        } else if (visibility == 'hidden') { // hide if behind
2452          var elPos = hs.getPosition(els[i]);
2453          elPos.w = els[i].offsetWidth;
2454          elPos.h = els[i].offsetHeight;
2455          if (!this.dimmingOpacity) { // hide all if dimming
2456          
2457            var clearsX = (elPos.x + elPos.w < this.x.get('opos') 
2458              || elPos.x > this.x.get('opos') + this.x.get('osize'));
2459            var clearsY = (elPos.y + elPos.h < this.y.get('opos') 
2460              || elPos.y > this.y.get('opos') + this.y.get('osize'));
2461          }
2462          var wrapperKey = hs.getWrapperKey(els[i]);
2463          if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
2464            if (!hiddenBy) {
2465              els[i].setAttribute('hidden-by', '['+ this.key +']');
2466              els[i].origProp = els[i].style[prop];
2467              els[i].style[prop] = 'hidden';
2468              
2469            } else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
2470              els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
2471            }
2472          } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
2473              && wrapperKey != this.key) { // on move
2474            els[i].setAttribute('hidden-by', '');
2475            els[i].style[prop] = els[i].origProp || '';
2476          } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
2477            els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
2478          }
2479              
2480        }
2481      }
2482    }
2483},
2484
2485focus : function() {
2486    this.wrapper.style.zIndex = hs.zIndexCounter += 2;
2487    // blur others
2488    for (var i = 0; i < hs.expanders.length; i++) {
2489      if (hs.expanders[i] && i == hs.focusKey) {
2490        var blurExp = hs.expanders[i];
2491        blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
2492        if (blurExp.isImage) {
2493          blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer';
2494          blurExp.content.title = hs.lang.focusTitle;  
2495        }  
2496        hs.fireEvent(blurExp, 'onBlur');
2497      }
2498    }
2499    
2500    // focus this
2501    if (this.outline) this.outline.table.style.zIndex 
2502      = this.wrapper.style.zIndex - 1;
2503    this.content.className = 'highslide-'+ this.contentType;
2504    if (this.isImage) {
2505      this.content.title = hs.lang.restoreTitle;
2506      
2507      if (hs.restoreCursor) {
2508        hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
2509        if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
2510        this.content.style.cursor = hs.styleRestoreCursor;
2511      }
2512    }
2513    hs.focusKey = this.key;  
2514    hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);  
2515    hs.fireEvent(this, 'onFocus');  
2516},
2517moveTo: function(x, y) {
2518    this.x.setPos(x);
2519    this.y.setPos(y);
2520},
2521resize : function (e) {
2522    var w, h, r = e.width / e.height;
2523    w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
2524    if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
2525    h = this.isHtml ? e.height + e.dY : w / r;
2526    if (h < Math.min(this.minHeight, this.y.full)) {
2527      h = Math.min(this.minHeight, this.y.full);
2528      if (this.isImage) w = h * r;
2529    }
2530    this.resizeTo(w, h);
2531},
2532resizeTo: function(w, h) {
2533    this.y.setSize(h);
2534    this.x.setSize(w);
2535    this.wrapper.style.height = this.y.get('wsize') +'px';
2536},
2537
2538close : function() {
2539    if (this.isClosing || !this.isExpanded) return;
2540    if (this.transitions[1] == 'crossfade' && hs.upcoming) {
2541      hs.getExpander(hs.upcoming).cancelLoading();
2542      hs.upcoming = null;
2543    }
2544    if (!hs.fireEvent(this, 'onBeforeClose')) return;
2545    this.isClosing = true;
2546    if (this.slideshow && !hs.upcoming) this.slideshow.pause();
2547    
2548    hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
2549    
2550    try {
2551      if (this.isHtml) this.htmlPrepareClose();
2552      this.content.style.cursor = 'default';
2553      this.changeSize(
2554        0, {
2555          wrapper: {
2556            width : this.x.t,
2557            height : this.y.t,
2558            left: this.x.tpos - this.x.cb + this.x.tb,
2559            top: this.y.tpos - this.y.cb + this.y.tb
2560          },
2561          content: {
2562            left: 0,
2563            top: 0,
2564            width: this.x.t,
2565            height: this.y.t
2566          }
2567        }, hs.restoreDuration
2568      );
2569    } catch (e) { this.afterClose(); }
2570},
2571
2572htmlPrepareClose : function() {
2573    if (hs.geckoMac) { // bad redraws
2574      if (!hs.mask) hs.mask = hs.createElement('div', null, 
2575        { position: 'absolute' }, hs.container);
2576      hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 
2577        left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' });      
2578    }
2579    if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {}
2580    
2581    if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject();    
2582    if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 
2583      this.scrollerDiv.style.overflow = 'hidden';
2584},
2585
2586destroyObject : function () {
2587    if (hs.ie && this.iframe)
2588      try { this.iframe.contentWindow.document.body.innerHTML = ''; } catch (e) {}
2589    if (this.objectType == 'swf') swfobject.removeSWF(this.body.id);
2590    this.body.innerHTML = '';
2591},
2592
2593sleep : function() {
2594    if (this.outline) this.outline.table.style.display = 'none';
2595    this.releaseMask = null;
2596    this.wrapper.style.display = 'none';
2597    this.isExpanded = false;
2598    hs.push(hs.sleeping, this);
2599},
2600
2601awake : function() {try {
2602    
2603    hs.expanders[this.key] = this;
2604    
2605    if (!hs.allowMultipleInstances &&hs.focusKey != this.key) {  
2606      try { hs.expanders[hs.focusKey].close(); } catch (e){}
2607    }
2608    
2609    var z = hs.zIndexCounter++, stl = { display: '', zIndex: z };
2610    hs.setStyles (this.wrapper, stl);
2611    this.isClosing = false;
2612    
2613    var o = this.outline || 0;
2614    if (o) {
2615      if (!this.outlineWhileAnimating) stl.visibility = 'hidden';
2616      hs.setStyles (o.table, stl);    
2617    }
2618    if (this.slideshow) {
2619      this.initSlideshow();
2620    }
2621      
2622    this.show();
2623} catch (e) {}
2624
2625
2626},
2627
2628createOverlay : function (o) {
2629    var el = o.overlayId, 
2630      relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position));
2631    if (typeof el == 'string') el = hs.getNode(el);
2632    if (o.html) el = hs.createElement('div', { innerHTML: o.html });
2633    if (!el || typeof el == 'string') return;
2634    if (!hs.fireEvent(this, 'onCreateOverlay', { overlay: el })) return;
2635    el.style.display = 'block';
2636    o.hsId = o.hsId || o.overlayId; 
2637    if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return;
2638    this.genOverlayBox();
2639    var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
2640    if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
2641    var overlay = hs.createElement(
2642      'div', {
2643        id: 'hsId'+ hs.idCounter++,
2644        hsId: o.hsId
2645      }, {
2646        position: 'absolute',
2647        visibility: 'hidden',
2648        width: width,
2649        direction: hs.lang.cssDirection || '',
2650        opacity: 0
2651      },
2652      relToVP ? hs.viewport :this.overlayBox,
2653      true
2654    );
2655    if (relToVP) overlay.hsKey = this.key;
2656    
2657    overlay.appendChild(el);
2658    hs.extend(overlay, {
2659      opacity: 1,
2660      offsetX: 0,
2661      offsetY: 0,
2662      dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
2663    });
2664    hs.extend(overlay, o);
2665    
2666      
2667    if (this.gotOverlays) {
2668      this.positionOverlay(overlay);
2669      if (!overlay.hideOnMouseOut || this.mouseIsOver) 
2670        hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
2671    }
2672    hs.push(this.overlays, hs.idCounter - 1);
2673},
2674positionOverlay : function(overlay) {
2675    var p = overlay.position || 'middle center',
2676      relToVP = (overlay.relativeTo == 'viewport'),
2677      offX = overlay.offsetX,
2678      offY = overlay.offsetY;
2679    if (relToVP) {
2680      hs.viewport.style.display = 'block';
2681      overlay.hsKey = this.key;
2682      if (overlay.offsetWidth > overlay.parentNode.offsetWidth)
2683        overlay.style.width = '100%';
2684    } else
2685    if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
2686    if (/left$/.test(p)) overlay.style.left = offX +'px'; 
2687    
2688    if (/center$/.test(p))  hs.setStyles (overlay, { 
2689      left: '50%',
2690      marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
2691    });  
2692    
2693    if (/right$/.test(p)) overlay.style.right = - offX +'px';
2694      
2695    if (/^leftpanel$/.test(p)) { 
2696      hs.setStyles(overlay, {
2697        right: '100%',
2698        marginRight: this.x.cb +'px',
2699        top: - this.y.cb +'px',
2700        bottom: - this.y.cb +'px',
2701        overflow: 'auto'
2702      });     
2703      this.x.p1 = overlay.offsetWidth;
2704    
2705    } else if (/^rightpanel$/.test(p)) {
2706      hs.setStyles(overlay, {
2707        left: '100%',
2708        marginLeft: this.x.cb +'px',
2709        top: - this.y.cb +'px',
2710        bottom: - this.y.cb +'px',
2711        overflow: 'auto'
2712      });
2713      this.x.p2 = overlay.offsetWidth;
2714    }
2715    var parOff = overlay.parentNode.offsetHeight;
2716    overlay.style.height = 'auto';
2717    if (relToVP && overlay.offsetHeight > parOff)
2718      overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%';
2719
2720    if (/^top/.test(p)) overlay.style.top = offY +'px'; 
2721    if (/^middle/.test(p))  hs.setStyles (overlay, { 
2722      top: '50%', 
2723      marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
2724    });  
2725    if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
2726    if (/^above$/.test(p)) {
2727      hs.setStyles(overlay, {
2728        left: (- this.x.p1 - this.x.cb) +'px',
2729        right: (- this.x.p2 - this.x.cb) +'px',
2730        bottom: '100%',
2731        marginBottom: this.y.cb +'px',
2732        width: 'auto'
2733      });
2734      this.y.p1 = overlay.offsetHeight;
2735    
2736    } else if (/^below$/.test(p)) {
2737      hs.setStyles(overlay, {
2738        position: 'relative',
2739        left: (- this.x.p1 - this.x.cb) +'px',
2740        right: (- this.x.p2 - this.x.cb) +'px',
2741        top: '100%',
2742        marginTop: this.y.cb +'px',
2743        width: 'auto'
2744      });
2745      this.y.p2 = overlay.offsetHeight;
2746      overlay.style.position = 'absolute';
2747    }
2748},
2749
2750getOverlays : function() {  
2751    this.getInline(['heading', 'caption'], true);
2752    this.getNumber();
2753    if (this.caption) hs.fireEvent(this, 'onAfterGetCaption');
2754    if (this.heading) hs.fireEvent(this, 'onAfterGetHeading');
2755    if (this.heading && this.dragByHeading) this.heading.className += ' highsli
2755de-move';
2756    if (hs.showCredits) this.writeCredits();
2757    for (var i = 0; i < hs.overlays.length; i++) {
2758      var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
2759      if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
2760          || (sg && sg === this.slideshowGroup)) {
2761        if (this.isImage || (this.isHtml && o.useOnHtml))
2762        this.createOverlay(o);
2763      }
2764    }
2765    var os = [];
2766    for (var i = 0; i < this.overlays.length; i++) {
2767      var o = hs.$('hsId'+ this.overlays[i]);
2768      if (/panel$/.test(o.position)) this.positionOverlay(o);
2769      else hs.push(os, o);
2770    }
2771    for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
2772    this.gotOverlays = true;
2773},
2774genOverlayBox : function() {
2775    if (!this.overlayBox) this.overlayBox = hs.createElement (
2776      'div', {
2777        className: this.wrapperClassName
2778      }, {
2779        position : 'absolute',
2780        width: (this.x.size || (this.useBox ? this.width : null) 
2781          || this.x.full) +'px',
2782        height: (this.y.size || this.y.full) +'px',
2783        visibility : 'hidden',
2784        overflow : 'hidden',
2785        zIndex : hs.ie ? 4 : 'auto'
2786      },
2787      hs.container,
2788      true
2789    );
2790},
2791sizeOverlayBox : function(doWrapper, doPanels) {
2792    var overlayBox = this.overlayBox, 
2793      x = this.x,
2794      y = this.y;
2795    hs.setStyles( overlayBox, {
2796      width: x.size +'px', 
2797      height: y.size +'px'
2798    });
2799    if (doWrapper || doPanels) {
2800      for (var i = 0; i < this.overlays.length; i++) {
2801        var o = hs.$('hsId'+ this.overlays[i]);
2802        var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
2803        if (o && /^(above|below)$/.test(o.position)) {
2804          if (ie6) {
2805            o.style.width = (overlayBox.offsetWidth + 2 * x.cb
2806              + x.p1 + x.p2) +'px';
2807          }
2808          y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
2809        }
2810        if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
2811          o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
2812        }
2813      }
2814    }
2815    if (doWrapper) {
2816      hs.setStyles(this.content, {
2817        top: y.p1 +'px'
2818      });
2819      hs.setStyles(overlayBox, {
2820        top: (y.p1 + y.cb) +'px'
2821      });
2822    }
2823},
2824
2825showOverlays : function() {
2826    var b = this.overlayBox;
2827    b.className = '';
2828    hs.setStyles(b, {
2829      top: (this.y.p1 + this.y.cb) +'px',
2830      left: (this.x.p1 + this.x.cb) +'px',
2831      overflow : 'visible'
2832    });
2833    if (hs.safari) b.style.visibility = 'visible';
2834    this.wrapper.appendChild (b);
2835    for (var i = 0; i < this.overlays.length; i++) {
2836      var o = hs.$('hsId'+ this.overlays[i]);
2837      o.style.zIndex = o.zIndex || 4;
2838      if (!o.hideOnMouseOut || this.mouseIsOver) {
2839        o.style.visibility = 'visible';
2840        hs.setStyles(o, { visibility: 'visible', display: '' });
2841        hs.animate(o, { opacity: o.opacity }, o.dur);
2842      }
2843    }
2844},
2845
2846destroyOverlays : function() {
2847    if (!this.overlays.length) return;
2848    if (this.slideshow) {
2849      var c = this.slideshow.controls;
2850      if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c);
2851    }
2852    for (var i = 0; i < this.overlays.length; i++) {
2853      var o = hs.$('hsId'+ this.overlays[i]);
2854      if (o && o.parentNode == hs.viewport && hs.getExpander(o) == this) hs.discardElement(o);
2855    }
2856    if (this.isHtml && this.preserveContent) {
2857      this.overlayBox.style.top = '-9999px';
2858      hs.container.appendChild(this.overlayBox);
2859    } else
2860    hs.discardElement(this.overlayBox);
2861},
2862
2863
2864
2865createFullExpand : function () {
2866    if (this.slideshow && this.slideshow.controls) {
2867      this.slideshow.enable('full-expand');
2868      return;
2869    }
2870    this.fullExpandLabel = hs.createElement(
2871      'a', {
2872        href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
2873        title: hs.lang.fullExpandTitle,
2874        className: 'highslide-full-expand'
2875      }
2876    );
2877    if (!hs.fireEvent(this, 'onCreateFullExpand')) return;
2878    
2879    this.createOverlay({ 
2880      overlayId: this.fullExpandLabel, 
2881      position: hs.fullExpandPosition, 
2882      hideOnMouseOut: true, 
2883      opacity: hs.fullExpandOpacity
2884    });
2885},
2886
2887doFullExpand : function () {
2888    try {
2889      if (!hs.fireEvent(this, 'onDoFullExpand')) return;
2890      if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
2891      
2892      this.focus();
2893      var xSize = this.x.size,
2894    ySize = this.y.size;
2895this.resizeTo(this.x.full, this.y.full);
2896
2897var xpos = this.x.pos - (this.x.size - xSize) / 2;
2898if (xpos < hs.marginLeft) xpos = hs.marginLeft;
2899
2900var ypos = this.y.pos - (this.y.size - ySize) / 2;
2901if (ypos < hs.marginTop) ypos = hs.marginTop;
2902
2903this.moveTo(xpos, ypos);
2904      this.doShowHide('hidden');
2905    
2906    } catch (e) {
2907      this.error(e);
2908    }
2909},
2910
2911
2912afterClose : function () {
2913    this.a.className = this.a.className.replace('highslide-active-anchor', '');
2914    
2915    this.doShowHide('visible');  
2916    
2917    if (this.isHtml && this.preserveContent
2918         && this.transitions[1] != 'crossfade') {
2919      this.sleep();
2920    } else {
2921      if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
2922    
2923      hs.discardElement(this.wrapper);
2924    }
2925    if (hs.mask) hs.mask.style.display = 'none';
2926    this.destroyOverlays();
2927    if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';
2928    
2929    if (this.dimmingOpacity) hs.undim(this.key);
2930    hs.fireEvent(this, 'onAfterClose');
2931    hs.expanders[this.key] = null;    
2932    hs.reOrder();
2933}
2934
2935};
2936
2937
2938// hs.Ajax object prototype
2939hs.Ajax = function (a, content, pre) {
2940    this.a = a;
2941    this.content = content;
2942    this.pre = pre;
2943};
2944
2945hs.Ajax.prototype = {
2946run : function () {
2947    var xhr;
2948    if (!this.src) this.src = hs.getSrc(this.a);
2949    if (this.src.match('#')) {
2950      var arr = this.src.split('#');
2951      this.src = arr[0];
2952      this.id = arr[1];
2953    }
2954    if (hs.cachedGets[this.src]) {
2955      this.cachedGet = hs.cachedGets[this.src];
2956      if (this.id) this.getElementContent();
2957      else this.loadHTML();
2958      return;
2959    }
2960    try { xhr = new XMLHttpRequest(); }
2961    catch (e) {
2962      try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); }
2963      catch (e) {
2964        try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
2965        catch (e) { this.onError(); }
2966      }
2967    }
2968    var pThis = this; 
2969    xhr.onreadystatechange = function() {
2970      if(pThis.xhr.readyState == 4) {
2971        if (pThis.id) pThis.getElementContent();
2972        else pThis.loadHTML();
2973      }
2974    };
2975    var src = this.src;
2976    this.xhr = xhr;
2977    if (hs.forceAjaxReload) 
2978      src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime());
2979    xhr.open('GET', src, true);
2980    xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
2981    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2982    xhr.send(null);
2983},
2984
2985getElementContent : function() {
2986    hs.init();
2987    var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null;
2988    
2989    this.iframe = hs.createElement('iframe', attribs, 
2990      { position: 'absolute', top: '-9999px' }, hs.container);
2991      
2992    this.loadHTML();
2993},
2994
2995loadHTML : function() {
2996    var s = this.cachedGet || this.xhr.responseText,
2997      regBody;
2998    if (this.pre) hs.cachedGets[this.src] = s;
2999    if (!hs.ie || hs.uaVersion >= 5.5) {
3000      s = s.replace(new RegExp('<link[^>]*>', 'gi'), '')
3001        .replace(new RegExp('<script[^>]*>.*?</script>', 'gi'), '');
3002      if (this.iframe) {
3003        var doc = this.iframe.contentDocument;
3004        if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document;
3005        if (!doc) { // Opera
3006          var pThis = this;
3007          setTimeout(function() {  pThis.loadHTML(); }, 25);
3008          return;
3009        }
3010        doc.open();
3011        doc.write(s);
3012        doc.close();
3013        try { s = doc.getElementById(this.id).innerHTML; } catch (e) {
3014          try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera
3015        }
3016        hs.discardElement(this.iframe);
3017      } else {
3018        regBody = /(<body[^>]*>|<\/body>)/ig;
3019        if (regBody.test(s)) s = s.split(regBody)[hs.ieLt9 ? 1 : 2];
3020        
3021      }
3022    }
3023    hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s;
3024    this.onLoad();
3025    for (var x in this) this[x] = null;
3026}
3027};
3028
3029
3030hs.Slideshow = function (expKey, options) {
3031    if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
3032    this.expKey = expKey;
3033    for (var x in options) this[x] = options[x];
3034    if (this.useControls) this.getControls();
3035    if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this);
3036};
3037hs.Slideshow.prototype = {
3038getControls: function() {
3039    this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) }, 
3040      null, hs.container);
3041    
3042    var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
3043    this.btn = {};
3044    var pThis = this;
3045    for (var i = 0; i < buttons.length; i++) {
3046      this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]);
3047      this.enable(buttons[i]);
3048    }
3049    this.btn.pause.style.display = 'none';
3050    //this.disable('full-expand');
3051},
3052checkFirstAndLast: function() {
3053    if (this.repeat || !this.controls) return;
3054    var exp = hs.expanders[this.expKey],
3055      cur = exp.getAnchorIndex(), 
3056      re = /disabled$/;
3057    if (cur == 0) 
3058      this.disable('previous');
3059    else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
3060      this.enable('previous');
3061    if (cur + 1 == hs.anchors.groups[exp.slideshowGroup || 'none'].length) {
3062      this.disable('next');
3063      this.disable('play');
3064    } else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) {
3065      this.enable('next');
3066      this.enable('play');
3067    }
3068},
3069enable: function(btn) {
3070    if (!this.btn) return;
3071    var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/;
3072    a.onclick = function() {
3073      sls[btn]();
3074      return false;
3075    };
3076    if (re.test(a.className)) a.className = a.className.replace(re, '');
3077},
3078disable: function(btn) {
3079    if (!this.btn) return;
3080    var a = this.btn[btn].getElementsByTagName('a')[0];
3081    a.onclick = function() { return false; };
3082    if (!/disabled$/.test(a.className)) a.className += ' disabled';
3083},
3084hitSpace: function() {
3085    if (this.autoplay) this.pause();
3086    else this.play();
3087},
3088play: function(wait) {
3089    if (this.btn) {
3090      this.btn.play.style.display = 'none';
3091      this.btn.pause.style.display = '';
3092    }
3093    
3094    this.autoplay = true;  
3095    if (!wait) hs.next(this.expKey);
3096},
3097pause: function() {
3098    if (this.btn) {
3099      this.btn.pause.style.display = 'none';
3100      this.btn.play.style.display = '';
3101    }
3102    
3103    clearTimeout(this.autoplay);
3104    this.autoplay = null;
3105},
3106previous: function() {
3107    this.pause();
3108    hs.previous(this.btn.previous);
3109},
3110next: function() {
3111    this.pause();
3112    hs.next(this.btn.next);
3113},
3114move: function() {},
3115'full-expand': function() {
3116    hs.getExpander().doFullExpand();
3117},
3118close: function() {
3119    hs.close(this.btn.close);
3120}
3121};
3122hs.Thumbstrip = function(slideshow) {
3123    function add (exp) {
3124      hs.extend(options || {}, {
3125        overlayId: dom,
3126        hsId: 'thumbstrip',
3127        className: 'highslide-thumbstrip-'+ mode +'-overlay ' + (options.className || '')
3128      });
3129      if (hs.ieLt7) options.fade = 0;
3130      exp.createOverlay(options);
3131      hs.setStyles(dom.parentNode, { overflow: 'hidden' });
3132    };
3133    
3134    function scroll (delta) {  
3135      selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
3136    };
3137    
3138    function selectThumb (i, scrollBy) {
3139      if (i === undefined) for (var j = 0; j < group.length; j++) {
3140        if (group[j] == hs.expanders[slideshow.expKey].a) {
3141          i = j;
3142          break;
3143        }
3144      }
3145      if (i === undefined) return;
3146      var as = dom.getElementsByTagName('a'),
3147        active = as[i],
3148        cell = active.parentNode,
3149        left = isX ? 'Left' : 'Top',
3150        right = isX ? 'Right' : 'Bottom',
3151        width = isX ? 'Width' : 'Height',
3152        offsetLeft = 'offset' + left,
3153        offsetWidth = 'offset' + width,
3154        overlayWidth = div.parentNode.parentNode[offsetWidth],
3155        minTblPos = overlayWidth - table[offsetWidth],
3156        curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0,
3157        tblPos = curTblPos,
3158        mgnRight = 20;
3159      if (scrollBy !== undefined) {
3160        tblPos = curTblPos - scrollBy;
3161        
3162        if (minTblPos > 0) minTblPos = 0;
3163        if (tblPos > 0) tblPos = 0;
3164        if (tblPos < minTblPos) tblPos = minTblPos;
3165        
3166    
3167      } else {
3168        for (var j = 0; j < as.length; j++) as[j].className = '';
3169        active.className = 'highslide-active-anchor';
3170        var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
3171          activeRight = cell[offsetLeft] + cell[offsetWidth] + 
3172            (as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
3173        if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight;
3174        else if (activeLeft < -curTblPos) tblPos = -activeLeft;
3175      }
3176      var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos;
3177      hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad');
3178      hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
3179      scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
3180      scrollDown.style.display = (tblPos > minTblPos)  ? 'block' : 'none';
3181      
3182    };
3183    
3184
3185    // initialize
3186    var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'],
3187      options = slideshow.thumbstrip,
3188      mode = options.mode || 'horizontal',
3189      floatMode = (mode == 'float'),
3190      tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'],
3191      isX = (mode == 'horizontal'),
3192      dom = hs.createElement('div', {
3193          className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode,
3194          innerHTML:
3195            '<div class="highslide-thumbstrip-inner">'+
3196            '<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+
3197            '<div class="highslide-scroll-up"><div></div></div>'+
3198            '<div class="highslide-scroll-down"><div></div></div>'+
3199            '<div class="highslide-marker"><div></div></div>'
3200        }, {
3201          display: 'none'
3202        }, hs.container),
3203      domCh = dom.childNodes,
3204      div = domCh[0],
3205      scrollUp = domCh[1],
3206      scrollDown = domCh[2],
3207      marker = domCh[3],
3208      table = div.firstChild,
3209      tbody = dom.getElementsByTagName(tree[1])[0],
3210      tr;
3211    for (var i = 0; i < group.length; i++) {
3212      if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody);
3213      (function(){
3214        var a = group[i],
3215          cell = hs.createElement(tree[3], null, null, tr),
3216          pI = i;
3217        hs.createElement('a', {
3218          href: a.href,
3219          title: a.title,
3220          onclick: function() {
3221            if (/highslide-active-anchor/.test(this.className)) return false;
3222            hs.getExpander(this).focus();
3223            return hs.transit(a);
3224          },
3225          innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
3226        }, null, cell);
3227      })();
3228    }
3229    if (!floatMode) {
3230      scrollUp.onclick = function () { scroll(-1); };
3231      scrollDown.onclick = function() { scroll(1); };
3232      hs.addEventListener(tbody, document.onmousewheel !== undefined ? 
3233          'mousewheel' : 'DOMMouseScroll', function(e) {        
3234        var delta = 0;
3235            e = e || window.event;
3236            if (e.wheelDelta) {
3237          delta = e.wheelDelta/120;
3238          if (hs.opera) delta = -delta;
3239            } else if (e.detail) {
3240          delta = -e.detail/3;
3241            }
3242            if (delta) scroll(-delta * 0.2);
3243        if (e.preventDefault) e.preventDefault();
3244        e.returnValue = false;
3245      });
3246    }
3247    
3248    return {
3249      add: add,
3250      selectThumb: selectThumb
3251    }
3252};
3253hs.langDefaults = hs.lang;
3254// history
3255var HsExpander = hs.Expander;
3256if (hs.ie && window == window.top) {
3257    (function () {
3258      try {
3259        document.documentElement.doScroll('left');
3260      } catch (e) {
3261        setTimeout(arguments.callee, 50);
3262        return;
3263      }
3264      hs.ready();
3265    })();
3266}
3267hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
3268hs.addEventListener(window, 'load', hs.ready);
3269
3270// set handlers
3271hs.addEventListener(document, 'ready', function() {
3272    if (hs.expandCursor || hs.dimmingOpacity) {
3273      var style = hs.createElement('style', { type: 'text/css' }, null, 
3274        document.getElementsByTagName('HEAD')[0]), 
3275        backCompat = document.compatMode == 'BackCompat';
3276        
3277      
3278      function addRule(sel, dec) {
3279        if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
3280          var last = document.styleSheets[document.styleSheets.length - 1];
3281          if (typeof(last.addRule) == "object") last.addRule(sel, dec);
3282        } else {
3283          style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
3284        }
3285      }
3286      function fix(prop) {
3287        return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
3288          ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
3289      }
3290      if (hs.expandCursor) addRule ('.highslide img', 
3291        'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;');
3292      addRule ('.highslide-viewport-size',
3293        hs.ie && (hs.uaVersion < 7 || backCompat) ?
3294          'position: absolute; '+
3295          'left:'+ fix('scrollLeft') +
3296          'top:'+ fix('scrollTop') +
3297          'width:'+ fix('clientWidth') +
3298          'height:'+ fix('clientHeight') :
3299          'position: fixed; width: 100%; height: 100%; left: 0; top: 0');
3300    }
3301});
3302hs.addEventListener(window, 'resize', function() {
3303    hs.getPageSize();
3304    if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) {
3305      var node = hs.viewport.childNodes[i],
3306        exp = hs.getExpander(node);
3307      exp.positionOverlay(node);
3308      if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb();
3309    }
3310});
3311hs.addEventListener(document, 'mousemove', function(e) {
3312    hs.mouse = { x: e.clientX, y: e.clientY  };
3313});
3314hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
3315hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
3316hs.addEventListener(document, 'ready', hs.setClickEvents);
3317hs.addEventListener(window, 'load', hs.preloadImages);
3318hs.addEventListener(window, 'load', hs.preloadAjax);
3319}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.