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