Advertisement
Guest User

Untitled

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