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