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