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