1/** 2 * Name: Highslide JS 3 * Version: 5.0.0 (2016-05-24) 4 * Config: default +inline +ajax +iframe +flash 5 * Author: Torstein Hønsi 6 * Support: www.highslide.com/support 7 * License: MIT 8 */ 9if (!hs) { var hs = { 10// Language strings 11lang : { 12 cssDirection: 'ltr', 13 loadingText : 'Loading...', 14 loadingTitle : 'Click to cancel', 15 focusTitle : 'Click to bring to front', 16 fullExpandTitle : 'Expand to actual size (f)', 17 creditsText : 'Powered by <i>Highslide JS</i>', 18 creditsTitle : 'Go to the Highslide JS homepage', 19 previousText : 'Previous', 20 nextText : 'Next', 21 moveText : 'Move', 22 closeText : 'Close', 23 closeTitle : 'Close (esc)', 24 resizeTitle : 'Resize', 25 playText : 'Play', 26 playTitle : 'Play slideshow (spacebar)', 27 pauseText : 'Pause', 28 pauseTitle : 'Pause slideshow (spacebar)', 29 previousTitle : 'Previous (arrow left)', 30 nextTitle : 'Next (arrow right)', 31 moveTitle : 'Move', 32 fullExpandText : '1:1', 33 restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.' 34}, 35// See http://highslide.com/ref for examples of settings 36graphicsDir : 'highslide/graphics/', 37expandCursor : 'zoomin.cur', // null disables 38restoreCursor : 'zoomout.cur', // null disables 39expandDuration : 250, // milliseconds 40restoreDuration : 250, 41marginLeft : 15, 42marginRight : 15, 43marginTop : 15, 44marginBottom : 15, 45zIndexCounter : 1001, // adjust to other absolutely positioned elements 46loadingOpacity : 0.75, 47allowMultipleInstances: true, 48numberOfImagesToPreload : 5, 49outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 50outlineStartOffset : 3, // ends at 10 51padToMinWidth : false, // pad the popup width to make room for wide caption 52fullExpandPosition : 'bottom right', 53fullExpandOpacity : 1, 54showCredits : true, // you can set this to false if you want 55creditsHref : 'http://highslide.com/', 56creditsTarget : '_self', 57enableKeyListener : true, 58openerTagNames : ['a'], // Add more to allow slideshow indexing 59 60allowWidthReduction : false, 61allowHeightReduction : true, 62preserveContent : true, // Preserve changes made to the content and position of HTML popups. 63objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion. 64cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup. 65dragByHeading: true, 66minWidth: 300, 67minHeight: 300, 68allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight 69outlineType : 'drop-shadow', // set null to disable outlines 70skin : { 71 contentWrapper: 72 '<div class="highslide-header"><ul>'+ 73 '<li class="highslide-previous">'+ 74 '<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+ 75 '<span>{hs.lang.previousText}</span></a>'+ 76 '</li>'+ 77 '<li class="highslide-next">'+ 78 '<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+ 79 '<span>{hs.lang.nextText}</span></a>'+ 80 '</li>'+ 81 '<li class="highslide-move">'+ 82 '<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+ 83 '<span>{hs.lang.moveText}</span></a>'+ 84 '</li>'+ 85 '<li class="highslide-close">'+ 86 '<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+ 87 '<span>{hs.lang.closeText}</span></a>'+ 88 '</li>'+ 89 '</ul></div>'+ 90 '<div class="highslide-body"></div>'+ 91 '<div class="highslide-footer"><div>'+ 92 '<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+ 93 '</div></div>' 94}, 95// END OF YOUR SETTINGS 96 97 98// declare internal properties 99preloadTheseImages : [], 100continuePreloading: true, 101expanders : [], 102overrides : [ 103 'allowSizeReduction', 104 'useBox', 105 'outlineType', 106 'outlineWhileAnimating', 107 'captionId', 108 'captionText', 109 'captionEval', 110 'captionOverlay', 111 'headingId', 112 'headingText', 113 'headingEval', 114 'headingOverlay', 115 'creditsPosition', 116 'dragByHeading', 117 118 'width', 119 'height', 120 121 'contentId', 122 'allowWidthReduction', 123 'allowHeightReduction', 124 'preserveContent', 125 'maincontentId', 126 'maincontentText', 127 'maincontentEval', 128 'objectType', 129 'cacheAjax', 130 'objectWidth', 131 'objectHeight', 132 'objectLoadTime', 133 'swfOptions', 134 'wrapperClassName', 135 'minWidth', 136 'minHeight', 137 'maxWidth', 138 'maxHeight', 139 'pageOrigin', 140 'slideshowGroup', 141 'easing', 142 'easingClose', 143 'fadeInOut', 144 'src' 145], 146overlays : [], 147idCounter : 0, 148oPos : { 149 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'], 150 y: ['above', 'top', 'middle', 'bottom', 'below'] 151}, 152mouse: {}, 153headingOverlay: {}, 154captionOverlay: {}, 155swfOptions: { flashvars: {}, params: {}, attributes: {} }, 156timers : [], 157 158pendingOutlines : {}, 159sleeping : [], 160preloadTheseAjax : [], 161cacheBindings : [], 162cachedGets : {}, 163clones : {}, 164onReady: [], 165uaVersion: document.documentMode || parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]), 166ie : (document.all && !window.opera), 167//ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant? 168safari : /Safari/.test(navigator.userAgent), 169geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent), 170 171$ : function (id) { 172 if (id) return document.getElementById(id); 173}, 174 175push : function (arr, val) { 176 arr[arr.length] = val; 177}, 178 179createElement : function (tag, attribs, styles, parent, nopad) { 180 var el = document.createElement(tag); 181 if (attribs) hs.extend(el, attribs); 182 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0}); 183 if (styles) hs.setStyles(el, styles); 184 if (parent) parent.appendChild(el); 185 return el; 186}, 187 188extend : function (el, attribs) { 189 for (var x in attribs) el[x] = attribs[x]; 190 return el; 191}, 192 193setStyles : function (el, styles) { 194 for (var x in styles) { 195 if (hs.ieLt9 && x == 'opacity') { 196 if (styles[x] > 0.99) el.style.removeAttribute('filter'); 197 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')'; 198 } 199 else el.style[x] = styles[x]; 200 } 201}, 202animate: function(el, prop, opt) { 203 var start, 204 end, 205 unit; 206 if (typeof opt != 'object' || opt === null) { 207 var args = arguments; 208 opt = { 209 duration: args[2], 210 easing: args[3], 211 complete: args[4] 212 }; 213 } 214 if (typeof opt.duration != 'number') opt.duration = 250; 215 opt.easing = Math[opt.easing] || Math.easeInQuad; 216 opt.curAnim = hs.extend({}
216, prop); 217 for (var name in prop) { 218 var e = new hs.fx(el, opt , name ); 219 220 start = parseFloat(hs.css(el, name)) || 0; 221 end = parseFloat(prop[name]); 222 unit = name != 'opacity' ? 'px' : ''; 223 224 e.custom( start, end, unit ); 225 } 226}, 227css: function(el, prop) { 228 if (el.style[prop]) { 229 return el.style[prop]; 230 } else if (document.defaultView) { 231 return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop); 232 233 } else { 234 if (prop == 'opacity') prop = 'filter'; 235 var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })]; 236 if (prop == 'filter') 237 val = val.replace(/alpha\(opacity=([0-9]+)\)/, 238 function (a, b) { return b / 100 }); 239 return val === '' ? 1 : val; 240 } 241}, 242 243getPageSize : function () { 244 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 245 ? d.documentElement : d.body, 246 ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined'); 247 248 var width = ieLt9 ? iebody.clientWidth : 249 (d.documentElement.clientWidth || self.innerWidth), 250 height = ieLt9 ? iebody.clientHeight : self.innerHeight; 251 hs.page = { 252 width: width, 253 height: height, 254 scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset, 255 scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset 256 }; 257 return hs.page; 258}, 259 260getPosition : function(el) { 261 var p = { x: el.offsetLeft, y: el.offsetTop }; 262 while (el.offsetParent) { 263 el = el.offsetParent; 264 p.x += el.offsetLeft; 265 p.y += el.offsetTop; 266 if (el != document.body && el != document.documentElement) { 267 p.x -= el.scrollLeft; 268 p.y -= el.scrollTop; 269 } 270 } 271 return p; 272}, 273 274expand : function(a, params, custom, type) { 275 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container); 276 if (typeof a.getParams == 'function') return params; 277 if (type == 'html') { 278 for (var i = 0; i < hs.sleeping.length; i++) { 279 if (hs.sleeping[i] && hs.sleeping[i].a == a) { 280 hs.sleeping[i].awake(); 281 hs.sleeping[i] = null; 282 return false; 283 } 284 } 285 hs.hasHtmlExpanders = true; 286 } 287 try { 288 new hs.Expander(a, params, custom, type); 289 return false; 290 } catch (e) { return true; } 291}, 292 293htmlExpand : function(a, params, custom) { 294 return hs.expand(a, params, custom, 'html'); 295}, 296 297getSelfRendered : function() { 298 return hs.createElement('div', { 299 className: 'highslide-html-content', 300 innerHTML: hs.replaceLang(hs.skin.contentWrapper) 301 }); 302}, 303getElementByClass : function (el, tagName, className) { 304 var els = el.getElementsByTagName(tagName); 305 for (var i = 0; i < els.length; i++) { 306 if ((new RegExp(className)).test(els[i].className)) { 307 return els[i]; 308 } 309 } 310 return null; 311}, 312replaceLang : function(s) { 313 s = s.replace(/\s/g, ' '); 314 var re = /{hs\.lang\.([^}]+)\}/g, 315 matches = s.match(re), 316 lang; 317 if (matches) for (var i = 0; i < matches.length; i++) { 318 lang = matches[i].replace(re, "$1"); 319 if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]); 320 } 321 return s; 322}, 323 324 325getCacheBinding : function (a) { 326 for (var i = 0; i < hs.cacheBindings.length; i++) { 327 if (hs.cacheBindings[i][0] == a) { 328 var c = hs.cacheBindings[i][1]; 329 hs.cacheBindings[i][1] = c.cloneNode(1); 330 return c; 331 } 332 } 333 return null; 334}, 335 336preloadAjax : function (e) { 337 var arr = hs.getAnchors(); 338 for (var i = 0; i < arr.htmls.length; i++) { 339 var a = arr.htmls[i]; 340 if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax')) 341 hs.push(hs.preloadTheseAjax, a); 342 } 343 344 hs.preloadAjaxElement(0); 345}, 346 347preloadAjaxElement : function (i) { 348 if (!hs.preloadTheseAjax[i]) return; 349 var a = hs.preloadTheseAjax[i]; 350 var cache = hs.getNode(hs.getParam(a, 'contentId')); 351 if (!cache) cache = hs.getSelfRendered(); 352 var ajax = new hs.Ajax(a, cache, 1); 353 ajax.onError = function () { }; 354 ajax.onLoad = function () { 355 hs.push(hs.cacheBindings, [a, cache]); 356 hs.preloadAjaxElement(i + 1); 357 }; 358 ajax.run(); 359}, 360 361focusTopmost : function() { 362 var topZ = 0, 363 topmostKey = -1, 364 expanders = hs.expanders, 365 exp, 366 zIndex; 367 for (var i = 0; i < expanders.length; i++) { 368 exp = expanders[i];
369 if (exp) { 370 zIndex = exp.wrapper.style.zIndex; 371 if (zIndex && zIndex > topZ) { 372 topZ = zIndex; 373 topmostKey = i; 374 } 375 } 376 } 377 if (topmostKey == -1) hs.focusKey = -1; 378 else expanders[topmostKey].focus(); 379}, 380 381getParam : function (a, param) { 382 a.getParams = a.onclick; 383 var p = a.getParams ? a.getParams() : null; 384 a.getParams = null; 385 386 return (p && typeof p[param] != 'undefined') ? p[param] : 387 (typeof hs[param] != 'undefined' ? hs[param] : null); 388}, 389 390getSrc : function (a) { 391 var src = hs.getParam(a, 'src'); 392 if (src) return src; 393 return a.href; 394}, 395 396getNode : function (id) { 397 var node = hs.$(id), clone = hs.clones[id], a = {}; 398 if (!node && !clone) return null; 399 if (!clone) { 400 clone = node.cloneNode(true); 401 clone.id = ''; 402 hs.clones[id] = clone; 403 return node; 404 } else { 405 return clone.cloneNode(true); 406 } 407}, 408 409discardElement : function(d) { 410 if (d) hs.garbageBin.appendChild(d); 411 hs.garbageBin.innerHTML = ''; 412}, 413transit : function (adj, exp) { 414 var last = exp || hs.getExpander(); 415 exp = last; 416 if (hs.upcoming) return false; 417 else hs.last = last; 418 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 419 try { 420 hs.upcoming = adj; 421 adj.onclick(); 422 } catch (e){ 423 hs.last = hs.upcoming = null; 424 } 425 try { 426 exp.close(); 427 } catch (e) {} 428 return false; 429}, 430 431previousOrNext : function (el, op) { 432 var exp = hs.getExpander(el); 433 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp); 434 else return false; 435}, 436 437previous : function (el) { 438 return hs.previousOrNext(el, -1); 439}, 440 441next : function (el) { 442 return hs.previousOrNext(el, 1); 443}, 444 445keyHandler : function(e) { 446 if (!e) e = window.event; 447 if (!e.target) e.target = e.srcElement; // ie 448 if (typeof e.target.form != 'undefined') return true; // form element has focus 449 var exp = hs.getExpander(); 450 451 var op = null; 452 switch (e.keyCode) { 453 case 70: // f 454 if (exp) exp.doFullExpand(); 455 return true; 456 case 32: // Space 457 case 34: // Page Down 458 case 39: // Arrow right 459 case 40: // Arrow down 460 op = 1; 461 break; 462 case 8: // Backspace 463 case 33: // Page Up 464 case 37: // Arrow left 465 case 38: // Arrow up 466 op = -1; 467 break; 468 case 27: // Escape 469 case 13: // Enter 470 op = 0; 471 } 472 if (op !== null) {hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 473 if (!hs.enableKeyListener) return true; 474 475 if (e.preventDefault) e.preventDefault(); 476 else e.returnValue = false; 477 if (exp) { 478 if (op == 0) { 479 exp.close(); 480 } else { 481 hs.previousOrNext(exp.key, op); 482 } 483 return false; 484 } 485 } 486 return true; 487}, 488 489 490registerOverlay : function (overlay) { 491 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } )); 492}, 493 494 495getWrapperKey : function (element, expOnly) { 496 var el, re = /^highslide-wrapper-([0-9]+)$/; 497 // 1. look in open expanders 498 el = element; 499 while (el.parentNode) { 500 if (el.id && re.test(el.id)) return el.id.replace(re, "$1"); 501 el = el.parentNode; 502 } 503 // 2. look in thumbnail 504 if (!expOnly) { 505 el = element; 506 while (el.parentNode) { 507 if (el.tagName && hs.isHsAnchor(el)) { 508 for (var key = 0; key < hs.expanders.length; key++) { 509 var exp = hs.expanders[key]; 510 if (exp && exp.a == el) return key; 511 } 512 } 513 el = el.parentNode; 514 } 515 } 516 return null; 517}, 518 519getExpander : function (el, expOnly) { 520 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null; 521 if (typeof el == 'number') return hs.expanders[el] || null; 522 if (typeof el == 'string') el = hs.$(el); 523 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null; 524}, 525 526isHsAnchor : function (a) { 527 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/)); 528}, 529 530reOrder : function () { 531 for (var i = 0; i < hs.expanders.length; i++) 532 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost(); 533}, 534 535mouseClickHandler : function(e) 536{ 537 if (!e) e = window.event; 538 if (e.button > 1) return true; 539 if (!e.target) e.target = e.srcElement; 540 541 var el = e.target; 542 while (el.parentNode 543 && !(/highslide-(image|move|html|resize)/.test(el.className))) 544 { 545 el = el.parentNode; 546 } 547 var exp = hs.getExpander(el); 548 if (exp && (exp.isClosing || !exp.isExpanded)) return true; 549 550 if (exp && e.type == 'mousedown') { 551 if (e.target.form) return true; 552 var match = el.className.match(/highslide-(image|move|resize)/); 553 if (match) { 554 hs.dragArgs = { 555 exp: exp , 556 type: match[1], 557 left: exp.x.pos, 558 width: exp.x.size, 559 top: exp.y.pos, 560 height: exp.y.size, 561 clickX: e.clientX, 562 clickY: e.clientY 563 }; 564 565 566 hs.addEventListener(document, 'mousemove', hs.dragHandler); 567 if (e.preventDefault) e.preventDefault(); // FF 568 569 if (/highslide-(image|html)-blur/.test(exp.content.className)) { 570 exp.focus(); 571 hs.hasFocused = true; 572 } 573 return false; 574 } 575 else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) { 576 exp.focus(); 577 exp.doShowHide('hidden'); 578 } 579 } else if (e.type == 'mouseup') { 580 581 hs.removeEventListener(document, 'mousemove', hs.dragHandler); 582 583 if (hs.dragArgs) { 584 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 585 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor; 586 var hasDragged = hs.dragArgs.hasDragged; 587 588 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) { 589 exp.close(); 590 } 591 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) { 592 hs.dragArgs.exp.doShowHide('hidden'); 593 } 594 595 if (hs.dragArgs.exp.releaseMask) 596 hs.dragArgs.exp.releaseMask.style.display = 'none'; 597 hs.hasFocused = false; 598 hs.dragArgs = null; 599 600 } else if (/highslide-image-blur/.test(el.className)) { 601 el.style.cursor = hs.styleRestoreCursor; 602 } 603 } 604 return false; 605}, 606 607dragHandler : function(e) 608{ 609 if (!hs.dragArgs) return true; 610 if (!e) e = window.event; 611 var a = hs.dragArgs, exp = a.exp; 612 if (exp.iframe) { 613 if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 614 { position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 615 left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4, background: (hs.ieLt9 ? 'white' : 'none'), 616 opacity: 0.01 }, 617 exp.wrapper, true); 618 if (exp.releaseMask.style.display == 'none') 619 exp.releaseMask.style.display = ''; 620 } 621 622 a.dX = e.clientX - a.clickX;
623 a.dY = e.clientY - a.clickY; 624 625 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2)); 626 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0) 627 || (distance > (hs.dragSensitivity || 5)); 628 629 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) { 630 631 if (a.type == 'resize') exp.resize(a); 632 else { 633 exp.moveTo(a.left + a.dX, a.top + a.dY); 634 if (a.type == 'image') exp.content.style.cursor = 'move'; 635 } 636 } 637 return false; 638}, 639 640wrapperMouseHandler : function (e) { 641 try { 642 if (!e) e = window.event; 643 var over = /mouseover/i.test(e.type); 644 if (!e.target) e.target = e.srcElement; // ie 645 if (!e.relatedTarget) e.relatedTarget = 646 over ? e.fromElement : e.toElement; // ie 647 var exp = hs.getExpander(e.target); 648 if (!exp.isExpanded) return; 649 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 650 || hs.dragArgs) return; 651 for (var i = 0; i < exp.overlays.length; i++) (function() { 652 var o = hs.$('hsId'+ exp.overlays[i]); 653 if (o && o.hideOnMouseOut) { 654 if (over) hs.setStyles(o, { visibility: 'visible', display: '' }); 655 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur); 656 } 657 })(); 658 } catch (e) {} 659}, 660addEventListener : function (el, event, func) { 661 if (el == document && event == 'ready') { 662 hs.push(hs.onReady, func); 663 } 664 try { 665 el.addEventListener(event, func, false); 666 } catch (e) { 667 try { 668 el.detachEvent('on'+ event, func); 669 el.attachEvent('on'+ event, func); 670 } catch (e) { 671 el['on'+ event] = func; 672 } 673 } 674}, 675 676removeEventListener : function (el, event, func) { 677 try { 678 el.removeEventListener(event, func, false); 679 } catch (e) { 680 try { 681 el.detachEvent('on'+ event, func); 682 } catch (e) { 683 el['on'+ event] = null; 684 } 685 } 686}, 687 688preloadFullImage : function (i) { 689 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') { 690 var img = document.createElement('img'); 691 img.onload = function() { 692 img = null; 693 hs.preloadFullImage(i + 1); 694 }; 695 img.src = hs.preloadTheseImages[i]; 696 } 697}, 698preloadImages : function (number) { 699 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number; 700 701 var arr = hs.getAnchors(); 702 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) { 703 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i])); 704 } 705 706 // preload outlines 707 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} ); 708 else 709 710 hs.preloadFullImage(0); 711 712 // preload cursor 713 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor }); 714}, 715 716 717init : function () { 718 if (!hs.container) { 719 720 hs.ieLt7 = hs.ie && hs.uaVersion < 7; 721 hs.ieLt9 = hs.ie && hs.uaVersion < 9; 722 723 hs.getPageSize(); 724 hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:'; 725 for (var x in hs.langDefaults) { 726 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x]; 727 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 728 hs.lang[x] = hs.langDefaults[x]; 729 } 730 731 hs.container = hs.createElement('div', { 732 className: 'highslide-container' 733 }, { 734 position: 'absolute', 735 left: 0, 736 top: 0, 737 width: '100%', 738 zIndex: hs.zIndexCounter, 739 direction: 'ltr' 740 }, 741 document.body, 742 true 743 ); 744 hs.loading = hs.createElement('a', { 745 className: 'highslide-loading', 746 title: hs.lang.loadingTitle, 747 innerHTML: hs.lang.loadingText, 748 href: 'javascript:;' 749 }, { 750 position: 'absolute', 751 top: '-9999px', 752 opacity: hs.loadingOpacity, 753 zIndex: 1 754 }, hs.container 755 ); 756 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container); 757 hs.clearing = hs.createElement('div', null, 758 { clear: 'both', paddingTop: '1px' }, null, true); 759 760 // http://www.robertpenner.com/easing/ 761 Math.linearTween = function (t, b, c, d) { 762 return c*t/d + b; 763 }; 764 Math.easeInQuad = function (t, b, c, d) { 765 return c*(t/=d)*t + b; 766 }; 767 768 hs.hideSelects = hs.ieLt7; 769 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 770 || (hs.ieLt7 && hs.uaVersion < 5.5)); 771 } 772}, 773ready : function() { 774 if (hs.isReady) return; 775 hs.isReady = true; 776 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
777}, 778 779updateAnchors : function() { 780 var el, els, all = [], images = [], htmls = [],groups = {}, re; 781 782 for (var i = 0; i < hs.openerTagNames.length; i++) { 783 els = document.getElementsByTagName(hs.openerTagNames[i]); 784 for (var j = 0; j < els.length; j++) { 785 el = els[j]; 786 re = hs.isHsAnchor(el); 787 if (re) { 788 hs.push(all, el); 789 if (re[0] == 'hs.expand') hs.push(images, el); 790 else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el); 791 var g = hs.getParam(el, 'slideshowGroup') || 'none'; 792 if (!groups[g]) groups[g] = []; 793 hs.push(groups[g], el); 794 } 795 } 796 } 797 hs.anchors = { all: all, groups: groups, images: images, htmls: htmls }; 798 return hs.anchors; 799 800}, 801 802getAnchors : function() { 803 return hs.anchors || hs.updateAnchors(); 804}, 805 806 807close : function(el) { 808 var exp = hs.getExpander(el); 809 if (exp) exp.close(); 810 return false; 811} 812}; // end hs object 813hs.fx = function( elem, options, prop ){ 814 this.options = options; 815 this.elem = elem; 816 this.prop = prop; 817 818 if (!options.orig) options.orig = {}; 819}; 820hs.fx.prototype = { 821 update: function(){ 822 (hs.fx.step[this.prop] || hs.fx.step._default)(this); 823 824 if (this.options.step) 825 this.options.step.call(this.elem, this.now, this); 826 827 }, 828 custom: function(from, to, unit){ 829 this.startTime = (new Date()).getTime(); 830 this.start = from; 831 this.end = to; 832 this.unit = unit;// || this.unit || "px"; 833 this.now = this.start; 834 this.pos = this.state = 0; 835 836 var self = this; 837 function t(gotoEnd){ 838 return self.step(gotoEnd); 839 } 840 841 t.elem = this.elem; 842 843 if ( t() && hs.timers.push(t) == 1 ) { 844 hs.timerId = setInterval(function(){ 845 var timers = hs.timers; 846 847 for ( var i = 0; i < timers.length; i++ ) 848 if ( !timers[i]() ) 849 timers.splice(i--, 1); 850 851 if ( !timers.length ) { 852 clearInterval(hs.timerId); 853 } 854 }, 13); 855 } 856 }, 857 step: function(gotoEnd){ 858 var t = (new Date()).getTime(); 859 if ( gotoEnd || t >= this.options.duration + this.startTime ) { 860 this.now = this.end; 861 this.pos = this.state = 1; 862 this.update(); 863 864 this.options.curAnim[ this.prop ] = true; 865 866 var done = true; 867 for ( var i in this.options.curAnim ) 868 if ( this.options.curAnim[i] !== true ) 869 done = false; 870 871 if ( done ) { 872 if (this.options.complete) this.options.complete.call(this.elem); 873 } 874 return false; 875 } else { 876 var n = t - this.startTime; 877 this.state = n / this.options.duration; 878 this.pos = this.options.easing(n, 0, 1, this.options.duration);
879 this.now = this.start + ((this.end - this.start) * this.pos); 880 this.update(); 881 } 882 return true; 883 } 884 885}; 886 887hs.extend( hs.fx, { 888 step: { 889 890 opacity: function(fx){ 891 hs.setStyles(fx.elem, { opacity: fx.now }); 892 }, 893 894 _default: function(fx){ 895 try { 896 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) 897 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 898 else 899 fx.elem[ fx.prop ] = fx.now; 900 } catch (e) {} 901 } 902 } 903}); 904 905hs.Outline = function (outlineType, onLoad) { 906 this.onLoad = onLoad; 907 this.outlineType = outlineType; 908 var v = hs.uaVersion, tr; 909 910 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7; 911 if (!outlineType) { 912 if (onLoad) onLoad(); 913 return; 914 } 915 916 hs.init(); 917 this.table = hs.createElement( 918 'table', { 919 cellSpacing: 0 920 }, { 921 visibility: 'hidden', 922 position: 'absolute', 923 borderCollapse: 'collapse', 924 width: 0 925 }, 926 hs.container, 927 true 928 ); 929 var tbody = hs.createElement('tbody', null, null, this.table, 1); 930 931 this.td = []; 932 for (var i = 0; i <= 8; i++) { 933 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true); 934 this.td[i] = hs.createElement('td', null, null, tr, true); 935 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' }; 936 hs.setStyles(this.td[i], style); 937 }
938 this.td[4].className = outlineType +' highslide-outline'; 939 940 this.preloadGraphic(); 941}; 942 943hs.Outline.prototype = { 944preloadGraphic : function () { 945 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png"; 946 947 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null; 948 this.graphic = hs.createElement('img', null, { position: 'absolute', 949 top: '-9999px' }, appendTo, true); // for onload trigger 950 951 var pThis = this; 952 this.graphic.onload = function() { pThis.onGraphicLoad(); }; 953 954 this.graphic.src = src; 955}, 956 957onGraphicLoad : function () { 958 var o = this.offset = this.graphic.width / 4, 959 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]], 960 dim = { height: (2*o) +'px', width: (2*o) +'px' }; 961 for (var i = 0; i <= 8; i++) { 962 if (pos[i]) { 963 if (this.hasAlphaImageLoader) { 964 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px'; 965 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true); 966 hs.createElement ('div', null, { 967 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 968 position: 'absolute', 969 width: w, 970 height: this.graphic.height +'px', 971 left: (pos[i][0]*o)+'px', 972 top: (pos[i][1]*o)+'px' 973 }, 974 div, 975 true); 976 } else { 977 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'}); 978 } 979 980 if (window.opera && (i == 3 || i ==5)) 981 hs.createElement('div', null, dim, this.td[i], true); 982 983 hs.setStyles (this.td[i], dim); 984 } 985 } 986 this.graphic = null; 987 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy(); 988 hs.pendingOutlines[this.outlineType] = this; 989 if (this.onLoad) this.onLoad(); 990}, 991 992setPosition : function (pos, offset, vis, dur, easing) { 993 var exp = this.exp, 994 stl = exp.wrapper.style, 995 offset = offset || 0, 996 pos = pos || { 997 x: exp.x.pos + offset, 998 y: exp.y.pos + offset, 999 w: exp.x.get('wsize') - 2 * offset, 1000 h: exp.y.get('wsize') - 2 * offset 1001 }; 1002 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 1003 ? 'visible' : 'hidden'; 1004 hs.setStyles(this.table, { 1005 left: (pos.x - this.offset) +'px', 1006 top: (pos.y - this.offset) +'px', 1007 width: (pos.w + 2 * this.offset) +'px' 1008 }); 1009 1010 pos.w -= 2 * this.offset; 1011 pos.h -= 2 * this.offset; 1012 hs.setStyles (this.td[4], { 1013 width: pos.w >= 0 ? pos.w +'px' : 0, 1014 height: pos.h >= 0 ? pos.h +'px' : 0 1015 }); 1016 if (this.hasAlphaImageLoader) this.td[3].style.height 1017 = this.td[5].style.height = this.td[4].style.height; 1018 1019}, 1020 1021destroy : function(hide) { 1022 if (hide) this.table.style.visibility = 'hidden'; 1023 else hs.discardElement(this.table); 1024} 1025}; 1026 1027hs.Dimension = function(exp, dim) { 1028 this.exp = exp; 1029 this.dim = dim; 1030 this.ucwh = dim == 'x' ? 'Width' : 'Height'; 1031 this.wh = this.ucwh.toLowerCase(); 1032 this.uclt = dim == 'x' ? 'Left' : 'Top'; 1033 this.lt = this.uclt.toLowerCase(); 1034 this.ucrb = dim == 'x' ? 'Right' : 'Bottom'; 1035 this.rb = this.ucrb.toLowerCase(); 1036 this.p1 = this.p2 = 0; 1037}; 1038hs.Dimension.prototype = { 1039get : function(key) { 1040 switch (key) { 1041 case 'loadingPos': 1042 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2; 1043 case 'wsize': 1044 return this.size + 2 * this.cb + this.p1 + this.p2; 1045 case 'fitsize': 1046 return this.clientSize - this.marginMin - this.marginMax; 1047 case 'maxsize': 1048 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ; 1049 case 'opos': 1050 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0); 1051 case 'osize': 1052 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0); 1053 case 'imgPad': 1054 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0; 1055 1056 } 1057}, 1058calcBorders: function() { 1059 // correct for borders 1060 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2; 1061 1062 this.marginMax = hs['margin'+ this.ucrb]; 1063}, 1064calcThumb: function() { 1065 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 1066 this.exp.el['offset'+ this.ucwh]; 1067 this.tpos = this.exp.tpos[this.dim]; 1068 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2; 1069 if (this.tpos == 0 || this.tpos == -1) { 1070 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt]; 1071 }; 1072}, 1073calcExpanded: function() { 1074 var exp = this.exp; 1075 this.justify = 'auto'; 1076 1077 1078 // size and position 1079 this.pos = this.tpos - this.cb + this.tb; 1080 1081 if (this.maxHeight && this.dim == 'x') 1082 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full); 1083 1084 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full); 1085 this.minSize = exp.allowSizeReduction ? 1086 Math.min(exp['min'+ this.ucwh], this.full) :this.full; 1087 if (exp.isImage && exp.useBox) { 1088 this.size = exp[this.wh]; 1089 this.imgSize = this.full; 1090 } 1091 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth; 1092 this.marginMin = hs['margin'+ this.uclt]; 1093 this.scroll = hs.page['scroll'+ this.uclt]; 1094 this.clientSize = hs.page[this.wh]; 1095}, 1096setSize: function(i) { 1097 var exp = this.exp; 1098 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) { 1099 this.imgSize = i; 1100 this.size = Math.max(this.size, this.imgSize); 1101 exp.content.style[this.lt] = this.get('imgPad')+'px'; 1102 } else 1103 this.size = i; 1104 1105 exp.content.style[this.wh] = i +'px'; 1106 exp.wrapper.style[this.wh] = this.get('wsize') +'px'; 1107 if (exp.outline) exp.outline.setPosition(); 1108 if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px'; 1109 if (this.dim == 'y' && exp.iDoc && exp.body.style.height != 'auto') try { 1110 exp.iDoc.body.style.overflow = 'auto'; 1111 } catch (e) {} 1112 if (exp.isHtml) { 1113 var d = exp.scrollerDiv; 1114 if (this.sizeDiff === undefined) 1115 this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh]; 1116 d.style[this.wh] = (this.size - this.sizeDiff) +'px'; 1117 1118 if (this.dim == 'x') exp.mediumContent.style.width = 'auto'; 1119 if (exp.body) exp.body.style[this.wh] = 'auto'; 1120 } 1121 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true); 1122}, 1123setPos: function(i) { 1124 this.pos = i; 1125 this.exp.wrapper.style[this.lt] = i +'px'; 1126 1127 if (this.exp.outline) this.exp.outline.setPosition(); 1128 1129} 1130}; 1131 1132hs.Expander = function(a, params, custom, contentType) { 1133 if (document.readyState && hs.ie && !hs.isReady) { 1134 hs.addEventListener(document, 'ready', function() { 1135 new hs.Expander(a, params, custom, contentType); 1136 }); 1137 return; 1138 } 1139 this.a = a; 1140 this.custom = custom; 1141 this.contentType = contentType || 'image'; 1142 this.isHtml = (contentType == 'html'); 1143 this.isImage = !this.isHtml; 1144 1145 hs.continuePreloading = false; 1146 this.overlays = []; 1147 hs.init(); 1148 var key = this.key = hs.expanders.length; 1149 // override inline parameters 1150 for (var i = 0; i < hs.overrides.length; i++) { 1151 var name = hs.overrides[i];
1152 this[name] = params && typeof params[name] != 'undefined' ? 1153 params[name] : hs[name]; 1154 } 1155 if (!this.src) this.src = a.href; 1156 1157 // get thumb 1158 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a; 1159 el = this.thumb = el.getElementsByTagName('img')[0] || el; 1160 this.thumbsUserSetId = el.id || a.id; 1161 1162 // check if already open 1163 for (var i = 0; i < hs.expanders.length; i++) { 1164 if (hs.expanders[i] && hs.expanders[i].a == a) { 1165 hs.expanders[i].focus(); 1166 return false; 1167 } 1168 } 1169 1170 // cancel other 1171 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) { 1172 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) { 1173 hs.expanders[i].cancelLoading(); 1174 } 1175 } 1176 hs.expanders[key] = this; 1177 if (!hs.allowMultipleInstances && !hs.upcoming) { 1178 if (hs.expanders[key-1]) hs.expanders[key-1].close(); 1179 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey]) 1180 hs.expanders[hs.focusKey].close(); 1181 } 1182 1183 // initiate metrics 1184 this.el = el; 1185 this.tpos = this.pageOrigin || hs.getPosition(el); 1186 hs.getPageSize(); 1187 var x = this.x = new hs.Dimension(this, 'x'); 1188 x.calcThumb(); 1189 var y = this.y = new hs.Dimension(this, 'y'); 1190 y.calcThumb(); 1191 this.wrapper = hs.createElement( 1192 'div', { 1193 id: 'highslide-wrapper-'+ this.key, 1194 className: 'highslide-wrapper '+ this.wrapperClassName 1195 }, { 1196 visibility: 'hidden', 1197 position: 'absolute', 1198 zIndex: hs.zIndexCounter += 2 1199 }, null, true ); 1200 1201 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler; 1202 if (this.contentType == 'image' && this.outlineWhileAnimating == 2) 1203 this.outlineWhileAnimating = 0; 1204 1205 // get the outline 1206 if (!this.outlineType) { 1207 this[this.contentType +'Create'](); 1208 1209 } else if (hs.pendingOutlines[this.outlineType]) { 1210 this.connectOutline(); 1211 this[this.contentType +'Create'](); 1212 1213 } else { 1214 this.showLoading(); 1215 var exp = this; 1216 new hs.Outline(this.outlineType, 1217 function () { 1218 exp.connectOutline(); 1219 exp[exp.contentType +'Create'](); 1220 } 1221 ); 1222 } 1223 return true; 1224}; 1225 1226hs.Expander.prototype = { 1227error : function(e) { 1228 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message); 1229 else window.location.href = this.src; 1230}, 1231 1232connectOutline : function() { 1233 var outline = this.outline = hs.pendingOutlines[this.outlineType]; 1234 outline.exp = this; 1235 outline.table.style.zIndex = this.wrapper.style.zIndex - 1; 1236 hs.pendingOutlines[this.outlineType] = null; 1237}, 1238 1239showLoading : function() { 1240 if (this.onLoadStarted || this.loading) return; 1241 1242 this.loading = hs.loading; 1243 var exp = this; 1244 this.loading.onclick = function() { 1245 exp.cancelLoading(); 1246 }; 1247 var exp = this, 1248 l = this.x.get('loadingPos') +'px', 1249 t = this.y.get('loadingPos') +'px'; 1250 setTimeout(function () { 1251 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })} 1252 , 100); 1253}, 1254 1255imageCreate : function() { 1256 var exp = this; 1257 1258 var img = document.createElement('img'); 1259 this.content = img; 1260 img.onload = function () { 1261 if (hs.expanders[exp.key]) exp.contentLoaded(); 1262 }; 1263 if (hs.blockRightClick) img.oncontextmenu = function() { return false; }; 1264 img.className = 'highslide-image'; 1265 hs.setStyles(img, { 1266 visibility: 'hidden', 1267 display: 'block', 1268 position: 'absolute', 1269 maxWidth: '9999px', 1270 zIndex: 3 1271 }); 1272 img.title = hs.lang.restoreTitle; 1273 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img); 1274 if (hs.ie && hs.flushImgSize) img.src = null; 1275 img.src = this.src; 1276 1277 this.showLoading(); 1278}, 1279 1280htmlCreate : function () { 1281 1282 this.content = hs.getCacheBinding(this.a); 1283 if (!this.content) 1284 this.content = hs.getNode(this.contentId); 1285 if (!this.content) 1286 this.content = hs.getSelfRendered(); 1287 this.getInline(['maincontent']); 1288 if (this.maincontent) { 1289 var body = hs.getElementByClass(this.content, 'div', 'highslide-body'); 1290 if (body) body.appendChild(this.maincontent); 1291 this.maincontent.style.display = 'block'; 1292 } 1293 1294 var innerContent = this.innerContent = this.content; 1295 1296 if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(innerContent); 1297 1298 // the content tree 1299 hs.container.appendChild(this.wrapper); 1300 hs.setStyles( this.wrapper, { 1301 position: 'static', 1302 padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px' 1303 }); 1304 this.content = hs.createElement( 1305 'div', { 1306 className: 'highslide-html' 1307 }, { 1308 position: 'relative', 1309 zIndex: 3, 1310 height: 0, 1311 overflow: 'hidden' 1312 }, 1313 this.wrapper 1314 ); 1315 this.mediumContent = hs.createElement('div', null, null, this.content, 1); 1316 this.mediumContent.appendChild(innerContent); 1317 1318 hs.setStyles (innerContent, { 1319 position: 'relative', 1320 display: 'block', 1321 direction: hs.lang.cssDirection || '' 1322 }); 1323 if (this.width) innerContent.style.width = this.width +'px'; 1324 if (this.height) hs.setStyles(innerContent, { 1325 height: this.height +'px', 1326 overflow: 'hidden' 1327 }); 1328 if (innerContent.offsetWidth < this.minWidth) 1329 innerContent.style.width = this.minWidth +'px'; 1330 1331 1332 1333 if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) { 1334 this.showLoading(); 1335 var exp = this; 1336 var ajax = new hs.Ajax(this.a, innerContent); 1337 ajax.src = this.src;
1338 ajax.onLoad = function () { if (hs.expanders[exp.key]) exp.contentLoaded(); }; 1339 ajax.onError = function () { location.href = exp.src; }; 1340 ajax.run(); 1341 } 1342 else 1343 1344 if (this.objectType == 'iframe' && this.objectLoadTime == 'before') { 1345 this.writeExtendedContent(); 1346 } 1347 else 1348 this.contentLoaded(); 1349}, 1350 1351contentLoaded : function() { 1352 try { 1353 if (!this.content) return; 1354 this.content.onload = null; 1355 if (this.onLoadStarted) return; 1356 else this.onLoadStarted = true; 1357 1358 var x = this.x, y = this.y; 1359 1360 if (this.loading) { 1361 hs.setStyles(this.loading, { top: '-9999px' }); 1362 this.loading = null; 1363 } 1364 if (this.isImage) { 1365 x.full = this.content.width; 1366 y.full = this.content.height; 1367 1368 hs.setStyles(this.content, { 1369 width: x.t +'px', 1370 height: y.t +'px' 1371 }); 1372 this.wrapper.appendChild(this.content); 1373 hs.container.appendChild(this.wrapper); 1374 } else if (this.htmlGetSize) this.htmlGetSize(); 1375 1376 x.calcBorders(); 1377 y.calcBorders(); 1378 1379 hs.setStyles (this.wrapper, { 1380 left: (x.tpos + x.tb - x.cb) +'px', 1381 top: (y.tpos + x.tb - y.cb) +'px' 1382 }); 1383 this.getOverlays(); 1384 1385 var ratio = x.full / y.full; 1386 x.calcExpanded(); 1387 this.justify(x); 1388 1389 y.calcExpanded(); 1390 this.justify(y); 1391 if (this.isHtml) this.htmlSizeOperations(); 1392 if (this.overlayBox) this.sizeOverlayBox(0, 1); 1393 1394 1395 if (this.allowSizeReduction) { 1396 if (this.isImage) 1397 this.correctRatio(ratio); 1398 else this.fitOverlayBox(); 1399 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) { 1400 this.createFullExpand(); 1401 if (this.overlays.length == 1) this.sizeOverlayBox(); 1402 } 1403 } 1404 this.show(); 1405 1406 } catch (e) { 1407 this.error(e); 1408 } 1409}, 1410 1411 1412setObjContainerSize : function(parent, auto) { 1413 var c = hs.getElementByClass(parent, 'DIV', 'highslide-body'); 1414 if (/(iframe|swf)/.test(this.objectType)) { 1415 if (this.objectWidth) c.style.width = this.objectWidth +'px'; 1416 if (this.objectHeight) c.style.height = this.objectHeight +'px'; 1417 } 1418}, 1419 1420writeExtendedContent : function () { 1421 if (this.hasExtendedContent) return; 1422 var exp = this; 1423 this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1424 if (this.objectType == 'iframe') { 1425 this.showLoading(); 1426 var ruler = hs.clearing.cloneNode(1); 1427 this.body.appendChild(ruler); 1428 this.newWidth = this.innerContent.offsetWidth; 1429 if (!this.objectWidth) this.objectWidth = ruler.offsetWidth; 1430 var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight, 1431 h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom, 1432 onload = this.objectLoadTime == 'before' ? 1433 ' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : ''; 1434 this.body.innerHTML += '<iframe name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" ' 1435 +' style="width:'+ this.objectWidth +'px; height:'+ h +'px" ' 1436 + onload +' src="'+ this.src +'" allowfullscreen></iframe>'; 1437 this.ruler = this.body.getElementsByTagName('div')[0]; 1438 this.iframe = this.body.getElementsByTagName('iframe')[0]; 1439 1440 if (this.objectLoadTime == 'after') this.correctIframeSize(); 1441 1442 } 1443 if (this.objectType == 'swf') { 1444 this.body.id = this.body.id || 'hs-flash-id-' + this.key; 1445 var a = this.swfOptions; 1446 if (!a.params) a.params = {}; 1447 if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent'; 1448 if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 1449 a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes); 1450 } 1451 this.hasExtendedContent = true; 1452}, 1453htmlGetSize : function() { 1454 if (this.iframe && !this.objectHeight) { // loadtime before 1455 this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px'; 1456 } 1457 this.innerContent.appendChild(hs.clearing); 1458 if (!this.x.full) this.x.full = this.innerContent.offsetWidth; 1459 this.y.full = this.innerContent.offsetHeight; 1460 this.innerContent.removeChild(hs.clearing); 1461 if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug 1462 this.newHeight = parseInt(this.innerContent.currentStyle.height); 1463 } 1464 hs.setStyles( this.wrapper, { position: 'absolute', padding: '0'}); 1465 hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'}); 1466 1467}, 1468 1469getIframePageHeight : function() { 1470 var h; 1471 try { 1472 var doc = this.iDoc = this.iframe.contentDocument || this.iframe.contentWindow.document; 1473 var clearing = doc.createElement('div'); 1474 clearing.style.clear = 'both'; 1475 doc.body.appendChild(clearing); 1476 h = clearing.offsetTop; 1477 if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 1478 + parseInt(doc.body.currentStyle.marginBottom) - 1; 1479 } catch (e) { // other domain 1480 h = 300; 1481 } 1482 return h; 1483}, 1484correctIframeSize : function () { 1485 var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth; 1486 hs.discardElement(this.ruler); 1487 if (wDiff < 0) wDiff = 0; 1488 1489 var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight; 1490 if (this.iDoc && !this.objectHeight && !this.height && this.y.size == this.y.full) try { 1491 this.iDoc.body.style.overflow = 'hidden'; 1492 } catch (e) {} 1493 hs.setStyles(this.iframe, { 1494 width: Math.abs(this.x.size - wDiff) +'px', 1495 height: Math.abs(this.y.size - hDiff) +'px' 1496 }); 1497 hs.setStyles(this.body, { 1498 width: this.iframe.style.width, 1499 height: this.iframe.style.height 1500 }); 1501 1502 this.scrollingContent = this.iframe; 1503 this.scrollerDiv = this.scrollingContent; 1504 1505}, 1506htmlSizeOperations : function () { 1507 1508 this.setObjContainerSize(this.innerContent); 1509 1510 1511 if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeE
1511xtendedContent(); 1512 1513 // handle minimum size 1514 if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full; 1515 if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full; 1516 this.scrollerDiv = this.innerContent; 1517 hs.setStyles(this.mediumContent, { 1518 position: 'relative', 1519 width: this.x.size +'px' 1520 }); 1521 hs.setStyles(this.innerContent, { 1522 border: 'none', 1523 width: 'auto', 1524 height: 'auto' 1525 }); 1526 var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1527 if (node && !/(iframe|swf)/.test(this.objectType)) { 1528 var cNode = node; // wrap to get true size 1529 node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true); 1530 cNode.parentNode.insertBefore(node, cNode); 1531 node.appendChild(hs.clearing); // IE6 1532 node.appendChild(cNode); 1533 1534 var wDiff = this.innerContent.offsetWidth - node.offsetWidth; 1535 var hDiff = this.innerContent.offsetHeight - node.offsetHeight; 1536 node.removeChild(hs.clearing); 1537 1538 var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug 1539 hs.setStyles(node, { 1540 width: (this.x.size - wDiff - kdeBugCorr) +'px', 1541 height: (this.y.size - hDiff) +'px', 1542 overflow: 'auto', 1543 position: 'relative' 1544 } 1545 ); 1546 if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight) { 1547 node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px'; 1548 } 1549 this.scrollingContent = node; 1550 this.scrollerDiv = this.scrollingContent; 1551 } 1552 if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize(); 1553 if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content; 1554 1555 if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) { 1556 this.x.size += 17; // room for scrollbars 1557 } 1558 if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) { 1559 setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}", 1560 hs.expandDuration); 1561 } 1562}, 1563 1564justify : function (p, moveOnly) { 1565 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y'; 1566 1567 var hasMovedMin = false; 1568 1569 var allowReduce = p.exp.allowSizeReduction; 1570 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2)); 1571 if (p.pos < p.scroll + p.marginMin) { 1572 p.pos = p.scroll + p.marginMin; 1573 hasMovedMin = true; 1574 } 1575 if (!moveOnly && p.size < p.minSize) { 1576 p.size = p.minSize; 1577 allowReduce = false; 1578 } 1579 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) { 1580 if (!moveOnly && hasMovedMin && allowReduce) { 1581 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize')); 1582 } else if (p.get('wsize') < p.get('fitsize')) { 1583 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize'); 1584 } else { // image larger than viewport 1585 p.pos = p.scroll + p.marginMin; 1586 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize'); 1587 } 1588 } 1589 1590 if (!moveOnly && p.size < p.minSize) { 1591 p.size = p.minSize; 1592 allowReduce = false; 1593 } 1594 1595 1596 1597 if (p.pos < p.marginMin) { 1598 var tmpMin = p.pos; 1599 p.pos = p.marginMin; 1600 1601 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin); 1602 1603 } 1604}, 1605 1606correctRatio : function(ratio) { 1607 var x = this.x, 1608 y = this.y, 1609 changed = false, 1610 xSize = Math.min(x.full, x.size), 1611 ySize = Math.min(y.full, y.size), 1612 useBox = (this.useBox || hs.padToMinWidth); 1613 1614 if (xSize / ySize > ratio) { // width greater 1615 xSize = ySize * ratio; 1616 if (xSize < x.minSize) { // below minWidth 1617 xSize = x.minSize; 1618 ySize = xSize / ratio; 1619 } 1620 changed = true; 1621 1622 } else if (xSize / ySize < ratio) { // height greater 1623 ySize = xSize / ratio; 1624 changed = true; 1625 } 1626 1627 if (hs.padToMinWidth && x.full < x.minSize) { 1628 x.imgSize = x.full; 1629 y.size = y.imgSize = y.full; 1630 } else if (this.useBox) { 1631 x.imgSize = xSize; 1632 y.imgSize = ySize; 1633 } else { 1634 x.size = xSize; 1635 y.size = ySize; 1636 } 1637 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed); 1638 if (useBox && y.size < y.imgSize) { 1639 y.imgSize = y.size; 1640 x.imgSize = y.size * ratio; 1641 } 1642 if (changed || useBox) { 1643 x.pos = x.tpos - x.cb + x.tb; 1644 x.minSize = x.size; 1645 this.justify(x, true); 1646 1647 y.pos = y.tpos - y.cb + y.tb; 1648 y.minSize = y.size; 1649 this.justify(y, true); 1650 if (this.overlayBox) this.sizeOverlayBox(); 1651 } 1652 1653 1654}, 1655fitOverlayBox : function(ratio, changed) { 1656 var x = this.x, y = this.y; 1657 if (this.overlayBox && (this.isImage || this.allowHeightReduction)) { 1658 while (y.size > this.minHeight && x.size > this.minWidth 1659 && y.get('wsize') > y.get('fitsize')) { 1660 y.size -= 10; 1661 if (ratio) x.size = y.size * ratio; 1662 this.sizeOverlayBox(0, 1); 1663 changed = true; 1664 } 1665 } 1666 return changed; 1667}, 1668 1669show : function () { 1670 var x = this.x, y = this.y; 1671 this.doShowHide('hidden'); 1672 1673 // Apply size change 1674 this.changeSize( 1675 1, { 1676 wrapper: { 1677 width : x.get('wsize'), 1678 height : y.get('wsize'), 1679 left: x.pos, 1680 top: y.pos 1681 }, 1682 content: { 1683 left: x.p1 + x.get('imgPad'), 1684 top: y.p1 + y.get('imgPad'), 1685 width:x.imgSize ||x.size, 1686 height:y.imgSize ||y.size 1687 } 1688 }, 1689 hs.expandDuration 1690 ); 1691}, 1692 1693changeSize : function(up, to, dur) { 1694 1695 if (this.outline && !this.outlineWhileAnimating) { 1696 if (up) this.outline.setPosition(); 1697 else this.outline.destroy( 1698 (this.isHtml && this.preserveContent)); 1699 } 1700 1701 1702 if (!up) this.destroyOverlays(); 1703 1704 var exp = this, 1705 x = exp.x, 1706 y = exp.y, 1707 easing = this.easing; 1708 if (!up) easing = this.easingClose || easing; 1709 var after = up ? 1710 function() { 1711 1712 if (exp.outline) exp.outline.table.style.visibility = "visible"; 1713 setTimeout(function() { 1714 exp.afterExpand(); 1715 }, 50); 1716 } : 1717 function() { 1718 exp.afterClose(); 1719 }; 1720 if (up) hs.setStyles( this.wrapper, { 1721 width: x.t +'px', 1722 height: y.t +'px' 1723 }); 1724 if (up && this.isHtml) { 1725 hs.setStyles(this.wrapper, { 1726 left: (x.tpos - x.cb + x.tb) +'px', 1727 top: (y.tpos - y.cb + y.tb) +'px' 1728 }); 1729 } 1730 if (this.fadeInOut) { 1731 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 }); 1732 hs.extend(to.wrapper, { opacity: up }); 1733 } 1734 hs.animate( this.wrapper, to.wrapper, { 1735 duration: dur, 1736 easing: easing, 1737 step: function(val, args) { 1738 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') { 1739 var fac = up ? args.pos : 1 - args.pos; 1740 var pos = { 1741 w: x.t + (x.get('wsize') - x.t) * fac, 1742 h: y.t + (y.get('wsize') - y.t) * fac, 1743 x: x.tpos + (x.pos - x.tpos) * fac, 1744 y: y.tpos + (y.pos - y.tpos) * fac 1745 }; 1746 exp.outline.setPosition(pos, 0, 1); 1747 } 1748 if (exp.isHtml) { 1749 if (args.prop == 'left') 1750 exp.mediumContent.style.left = (x.pos - val) +'px'; 1751 if (args.prop == 'top') 1752 exp.mediumContent.style.top = (y.pos - val) +'px'; 1753 } 1754 } 1755 }); 1756 hs.animate( this.content, to.content, dur, easing, after); 1757 if (up) { 1758 this.wrapper.style.visibility = 'visible'; 1759 this.content.style.visibility = 'visible'; 1760 if (this.isHtml) this.innerContent.style.visibility = 'visible';
1761 this.a.className += ' highslide-active-anchor'; 1762 } 1763}, 1764 1765 1766 1767 1768afterExpand : function() { 1769 this.isExpanded = true; 1770 this.focus(); 1771 1772 if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent(); 1773 if (this.iframe) { 1774 try { 1775 var exp = this, 1776 doc = this.iframe.contentDocument || this.iframe.contentWindow.document; 1777 hs.addEventListener(doc, 'mousedown', function () { 1778 if (hs.focusKey != exp.key) exp.focus(); 1779 }); 1780 } catch(e) {} 1781 if (hs.ie && typeof this.isClosing != 'boolean') // first open 1782 this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout 1783 } 1784 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null; 1785 this.prepareNextOutline(); 1786 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop; 1787 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize') 1788 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); 1789 if (this.overlayBox) this.showOverlays(); 1790 1791}, 1792 1793 1794prepareNextOutline : function() { 1795 var key = this.key; 1796 var outlineType = this.outlineType; 1797 new hs.Outline(outlineType, 1798 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} }); 1799}, 1800 1801 1802preloadNext : function() { 1803 var next = this.getAdjacentAnchor(1); 1804 if (next && next.onclick.toString().match(/hs\.expand/)) 1805 var img = hs.createElement('img', { src: hs.getSrc(next) }); 1806}, 1807 1808 1809getAdjacentAnchor : function(op) { 1810 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none']; 1811 return (as && as[current + op]) || null; 1812}, 1813 1814getAnchorIndex : function() { 1815 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none']; 1816 if (arr) for (var i = 0; i < arr.length; i++) { 1817 if (arr[i] == this.a) return i; 1818 } 1819 return null; 1820}, 1821 1822 1823cancelLoading : function() { 1824 hs.discardElement (this.wrapper); 1825 hs.expanders[this.key] = null; 1826 if (this.loading) hs.loading.style.left = '-9999px'; 1827}, 1828 1829writeCredits : function () { 1830 this.credits = hs.createElement('a', { 1831 href: hs.creditsHref, 1832 target: hs.creditsTarget, 1833 className: 'highslide-credits', 1834 innerHTML: hs.lang.creditsText, 1835 title: hs.lang.creditsTitle 1836 }); 1837 this.createOverlay({ 1838 overlayId: this.credits, 1839 position: this.creditsPosition || 'top left' 1840 }); 1841}, 1842 1843getInline : function(types, addOverlay) { 1844 for (var i = 0; i < types.length; i++) { 1845 var type = types[i], s = null; 1846 if (!this[type +'Id'] && this.thumbsUserSetId) 1847 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId; 1848 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']); 1849 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try { 1850 s = eval(this[type +'Eval']); 1851 } catch (e) {} 1852 if (!this[type] && this[type +'Text']) { 1853 s = this[type +'Text']; 1854 } 1855 if (!this[type] && !s) { 1856 this[type] = hs.getNode(this.a['_'+ type + 'Id']); 1857 if (!this[type]) { 1858 var next = this.a.nextSibling; 1859 while (next && !hs.isHsAnchor(next)) { 1860 if ((new RegExp('highslide-'+ type)).test(next.className || null)) { 1861 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++; 1862 this[type] = hs.getNode(next.id); 1863 break; 1864 } 1865 next = next.nextSibling; 1866 } 1867 } 1868 } 1869 1870 if (!this[type] && s) this[type] = hs.createElement('div', 1871 { className: 'highslide-'+ type, innerHTML: s } ); 1872 1873 if (addOverlay && this[type]) { 1874 var o = { position: (type == 'heading') ? 'above' : 'below' }; 1875 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x]; 1876 o.overlayId = this[type]; 1877 this.createOverlay(o); 1878 } 1879 } 1880}, 1881 1882 1883// on end move and resize 1884doShowHide : function(visibility) { 1885 if (hs.hideSelects) this.showHideElements('SELECT', visibility); 1886 if (hs.hideIframes) this.showHideElements('IFRAME', visibility); 1887 if (hs.geckoMac) this.showHideElements('*', visibility); 1888}, 1889showHideElements : function (tagName, visibility) { 1890 var els = document.getElementsByTagName(tagName); 1891 var prop = tagName == '*' ? 'overflow' : 'visibility'; 1892 for (var i = 0; i < els.length; i++) { 1893 if (prop == 'visibility' || (document.defaultView.getComputedStyle( 1894 els[i], "").getPropertyValue('overflow') == 'auto' 1895 || els[i].getAttribute('hidden-by') != null)) { 1896 var hiddenBy = els[i].getAttribute('hidden-by'); 1897 if (visibility == 'visible' && hiddenBy) { 1898 hiddenBy = hiddenBy.replace('['+ this.key +']', ''); 1899 els[i].setAttribute('hidden-by', hiddenBy); 1900 if (!hiddenBy) els[i].style[prop] = els[i].origProp; 1901 } else if (visibility == 'hidden') { // hide if behind 1902 var elPos = hs.getPosition(els[i]); 1903 elPos.w = els[i].offsetWidth; 1904 elPos.h = els[i].offsetHeight; 1905 1906 1907 var clearsX = (elPos.x + elPos.w < this.x.get('opos') 1908 || elPos.x > this.x.get('opos') + this.x.get('osize'));
1909 var clearsY = (elPos.y + elPos.h < this.y.get('opos') 1910 || elPos.y > this.y.get('opos') + this.y.get('osize')); 1911 var wrapperKey = hs.getWrapperKey(els[i]); 1912 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image 1913 if (!hiddenBy) { 1914 els[i].setAttribute('hidden-by', '['+ this.key +']'); 1915 els[i].origProp = els[i].style[prop]; 1916 els[i].style[prop] = 'hidden'; 1917 1918 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) { 1919 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']'); 1920 } 1921 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey) 1922 && wrapperKey != this.key) { // on move 1923 els[i].setAttribute('hidden-by', ''); 1924 els[i].style[prop] = els[i].origProp || ''; 1925 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) { 1926 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', '')); 1927 } 1928 1929 } 1930 } 1931 } 1932}, 1933 1934focus : function() { 1935 this.wrapper.style.zIndex = hs.zIndexCounter += 2; 1936 // blur others 1937 for (var i = 0; i < hs.expanders.length; i++) { 1938 if (hs.expanders[i] && i == hs.focusKey) { 1939 var blurExp = hs.expanders[i]; 1940 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur'; 1941 if (blurExp.isImage) { 1942 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer'; 1943 blurExp.content.title = hs.lang.focusTitle; 1944 } 1945 } 1946 } 1947 1948 // focus this 1949 if (this.outline) this.outline.table.style.zIndex 1950 = this.wrapper.style.zIndex - 1; 1951 this.content.className = 'highslide-'+ this.contentType; 1952 if (this.isImage) { 1953 this.content.title = hs.lang.restoreTitle; 1954 1955 if (hs.restoreCursor) { 1956 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer'; 1957 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand'; 1958 this.content.style.cursor = hs.styleRestoreCursor; 1959 } 1960 } 1961 hs.focusKey = this.key; 1962 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1963}, 1964moveTo: function(x, y) { 1965 this.x.setPos(x); 1966 this.y.setPos(y); 1967}, 1968resize : function (e) { 1969 var w, h, r = e.width / e.height; 1970 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full)); 1971 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full; 1972 h = this.isHtml ? e.height + e.dY : w / r; 1973 if (h < Math.min(this.minHeight, this.y.full)) { 1974 h = Math.min(this.minHeight, this.y.full); 1975 if (this.isImage) w = h * r; 1976 } 1977 this.resizeTo(w, h); 1978}, 1979resizeTo: function(w, h) { 1980 this.y.setSize(h); 1981 this.x.setSize(w); 1982 this.wrapper.style.height = this.y.get('wsize') +'px'; 1983}, 1984 1985close : function() { 1986 if (this.isClosing || !this.isExpanded) return; 1987 this.isClosing = true; 1988 1989 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1990 1991 try { 1992 if (this.isHtml) this.htmlPrepareClose(); 1993 this.content.style.cursor = 'default'; 1994 this.changeSize( 1995 0, { 1996 wrapper: { 1997 width : this.x.t, 1998 height : this.y.t, 1999 left: this.x.tpos - this.x.cb + this.x.tb, 2000 top: this.y.tpos - this.y.cb + this.y.tb 2001 }, 2002 content: { 2003 left: 0, 2004 top: 0, 2005 width: this.x.t, 2006 height: this.y.t 2007 } 2008 }, hs.restoreDuration 2009 ); 2010 } catch (e) { this.afterClose(); } 2011}, 2012 2013htmlPrepareClose : function() { 2014 if (hs.geckoMac) { // bad redraws 2015 if (!hs.mask) hs.mask = hs.createElement('div', null, 2016 { position: 'absolute' }, hs.container); 2017 hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 2018 left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' }); 2019 } 2020 if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {} 2021 2022 if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject(); 2023 if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 2024 this.scrollerDiv.style.overflow = 'hidden'; 2025}, 2026 2027destroyObject : function () { 2028 if (hs.ie && this.iframe) 2029 try { 2030 this.iframe.contentWindow.document.body.innerHTML = ''; 2031 } catch (e) { 2032 this.iframe.src = ''; 2033 } 2034 if (this.objectType == 'swf') swfobject.removeSWF(this.body.id); 2035 this.body.innerHTML = ''; 2036}, 2037 2038sleep : function() { 2039 if (this.outline) this.outline.table.style.display = 'none'; 2040 this.releaseMask = null; 2041 this.wrapper.style.display = 'none'; 2042 this.isExpanded = false; 2043 hs.push(hs.sleeping, this); 2044}, 2045 2046awake : function() {try { 2047 2048 hs.expanders[this.key] = this; 2049 2050 if (!hs.allowMultipleInstances &&hs.focusKey != this.key) { 2051 try { hs.expanders[hs.focusKey].close(); } catch (e){} 2052 } 2053 2054 var z = hs.zIndexCounter++, stl = { display: '', zIndex: z }; 2055 hs.setStyles (this.wrapper, stl); 2056 this.isClosing = false; 2057 2058 var o = this.outline || 0; 2059 if (o) { 2060 if (!this.outlineWhileAnimating) stl.visibility = 'hidden'; 2061 hs.setStyles (o.table, stl); 2062 } 2063 2064 this.show(); 2065} catch (e) {} 2066 2067 2068}, 2069 2070createOverlay : function (o) { 2071 var el = o.overlayId; 2072 if (typeof el == 'string') el = hs.getNode(el); 2073 if (o.html) el = hs.createElement('div', { innerHTML: o.html }); 2074 if (!el || typeof el == 'string') return; 2075 el.style.display = 'block'; 2076 this.genOverlayBox(); 2077 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto'; 2078 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
2079 var overlay = hs.createElement( 2080 'div', { 2081 id: 'hsId'+ hs.idCounter++, 2082 hsId: o.hsId 2083 }, { 2084 position: 'absolute', 2085 visibility: 'hidden', 2086 width: width, 2087 direction: hs.lang.cssDirection || '', 2088 opacity: 0 2089 },this.overlayBox, 2090 true 2091 ); 2092 2093 overlay.appendChild(el); 2094 hs.extend(overlay, { 2095 opacity: 1, 2096 offsetX: 0, 2097 offsetY: 0, 2098 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250 2099 }); 2100 hs.extend(overlay, o); 2101 2102 2103 if (this.gotOverlays) { 2104 this.positionOverlay(overlay); 2105 if (!overlay.hideOnMouseOut || this.mouseIsOver) 2106 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur); 2107 } 2108 hs.push(this.overlays, hs.idCounter - 1); 2109}, 2110positionOverlay : function(overlay) { 2111 var p = overlay.position || 'middle center', 2112 offX = overlay.offsetX, 2113 offY = overlay.offsetY; 2114 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay); 2115 if (/left$/.test(p)) overlay.style.left = offX +'px'; 2116 2117 if (/center$/.test(p)) hs.setStyles (overlay, { 2118 left: '50%', 2119 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px' 2120 }); 2121 2122 if (/right$/.test(p)) overlay.style.right = - offX +'px'; 2123 2124 if (/^leftpanel$/.test(p)) { 2125 hs.setStyles(overlay, { 2126 right: '100%', 2127 marginRight: this.x.cb +'px', 2128 top: - this.y.cb +'px', 2129 bottom: - this.y.cb +'px', 2130 overflow: 'auto' 2131 }); 2132 this.x.p1 = overlay.offsetWidth; 2133 2134 } else if (/^rightpanel$/.test(p)) { 2135 hs.setStyles(overlay, { 2136 left: '100%', 2137 marginLeft: this.x.cb +'px', 2138 top: - this.y.cb +'px', 2139 bottom: - this.y.cb +'px', 2140 overflow: 'auto' 2141 }); 2142 this.x.p2 = overlay.offsetWidth; 2143 } 2144 2145 if (/^top/.test(p)) overlay.style.top = offY +'px'; 2146 if (/^middle/.test(p)) hs.setStyles (overlay, { 2147 top: '50%', 2148 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px' 2149 }); 2150 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px'; 2151 if (/^above$/.test(p)) { 2152 hs.setStyles(overlay, { 2153 left: (- this.x.p1 - this.x.cb) +'px', 2154 right: (- this.x.p2 - this.x.cb) +'px', 2155 bottom: '100%', 2156 marginBottom: this.y.cb +'px', 2157 width: 'auto' 2158 }); 2159 this.y.p1 = overlay.offsetHeight; 2160 2161 } else if (/^below$/.test(p)) { 2162 hs.setStyles(overlay, { 2163 position: 'relative', 2164 left: (- this.x.p1 - this.x.cb) +'px', 2165 right: (- this.x.p2 - this.x.cb) +'px', 2166 top: '100%', 2167 marginTop: this.y.cb +'px', 2168 width: 'auto' 2169 }); 2170 this.y.p2 = overlay.offsetHeight; 2171 overlay.style.position = 'absolute'; 2172 } 2173}, 2174 2175getOverlays : function() { 2176 this.getInline(['heading', 'caption'], true); 2177 if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move'; 2178 if (hs.showCredits) this.writeCredits(); 2179 for (var i = 0; i < hs.overlays.length; i++) { 2180 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup; 2181 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId) 2182 || (sg && sg === this.slideshowGroup)) { 2183 if (this.isImage || (this.isHtml && o.useOnHtml)) 2184 this.createOverlay(o); 2185 } 2186 } 2187 var os = []; 2188 for (var i = 0; i < this.overlays.length; i++) { 2189 var o = hs.$('hsId'+ this.overlays[i]); 2190 if (/panel$/.test(o.position)) this.positionOverlay(o); 2191 else hs.push(os, o); 2192 } 2193 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]); 2194 this.gotOverlays = true; 2195}, 2196genOverlayBox : function() { 2197 if (!this.overlayBox) this.overlayBox = hs.createElement ( 2198 'div', { 2199 className: this.wrapperClassName 2200 }, { 2201 position : 'absolute', 2202 width: (this.x.size || (this.useBox ? this.width : null) 2203 || this.x.full) +'px', 2204 height: (this.y.size || this.y.full) +'px', 2205 visibility : 'hidden', 2206 overflow : 'hidden', 2207 zIndex : hs.ie ? 4 : 'auto' 2208 }, 2209 hs.container, 2210 true 2211 ); 2212}, 2213sizeOverlayBox : function(doWrapper, doPanels) { 2214 var overlayBox = this.overlayBox, 2215 x = this.x, 2216 y = this.y; 2217 hs.setStyles( overlayBox, { 2218 width: x.size +'px', 2219 height: y.size +'px' 2220 }); 2221 if (doWrapper || doPanels) { 2222 for (var i = 0; i < this.overlays.length; i++) { 2223 var o = hs.$('hsId'+ this.overlays[i]); 2224 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat'); 2225 if (o && /^(above|below)$/.test(o.position)) { 2226 if (ie6) { 2227 o.style.width = (overlayBox.offsetWidth + 2 * x.cb 2228 + x.p1 + x.p2) +'px'; 2229 } 2230 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight; 2231 } 2232 if (o && ie6 && /^(left|right)panel$/.test(o.position)) { 2233 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px'; 2234 } 2235 } 2236 } 2237 if (doWrapper) { 2238 hs.setStyles(this.content, { 2239 top: y.p1 +'px' 2240 }); 2241 hs.setStyles(overlayBox, { 2242 top: (y.p1 + y.cb) +'px' 2243 }); 2244 } 2245}, 2246 2247showOverlays : function() { 2248 var b = this.overlayBox; 2249 b.className = ''; 2250 hs.setStyles(b, { 2251 top: (this.y.p1 + this.y.cb) +'px', 2252 left: (this.x.p1 + this.x.cb) +'px', 2253 overflow : 'visible' 2254 }); 2255 if (hs.safari) b.style.visibility = 'visible'; 2256 this.wrapper.appendChild (b); 2257 for (var i = 0; i < this.overlays.length; i++) { 2258 var o = hs.$('hsId'+ this.overlays[i]); 2259 o.style.zIndex = o.zIndex || 4; 2260 if (!o.hideOnMouseOut || this.mouseIsOver) { 2261 o.style.visibility = 'visible'; 2262 hs.setStyles(o, { visibility: 'visible', display: '' }); 2263 hs.animate(o, { opacity: o.opacity }, o.dur); 2264 } 2265 } 2266}, 2267 2268destroyOverlays : function() { 2269 if (!this.overlays.length) return; 2270 if (this.isHtml && this.preserveContent) { 2271 this.overlayBox.style.top = '-9999px'; 2272 hs.container.appendChild(this.overlayBox); 2273 } else 2274 hs.discardElement(this.overlayBox); 2275}, 2276 2277 2278 2279createFullExpand : function () { 2280 this.fullExpandLabel = hs.createElement( 2281 'a', { 2282 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();', 2283 title: hs.lang.fullExpandTitle, 2284 className: 'highslide-full-expand' 2285 } 2286 ); 2287 2288 this.createOverlay({ 2289 overlayId: this.fullExpandLabel, 2290 position: hs.fullExpandPosition, 2291 hideOnMouseOut: true, 2292 opacity: hs.fullExpandOpacity 2293 }); 2294}, 2295 2296doFullExpand : function () { 2297 try { 2298 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel); 2299 2300 this.focus(); 2301 var xSize = this.x.size, 2302 ySize = this.y.size; 2303 this.resizeTo(this.x.full, this.y.full); 2304 2305 var xpos = this.x.pos - (this.x.size - xSize) / 2; 2306 if (xpos < hs.marginLeft) xpos = hs.marginLeft; 2307 2308 var ypos = this.y.pos - (this.y.size - ySize) / 2; 2309 if (ypos < hs.marginTop) ypos = hs.marginTop; 2310 2311 this.moveTo(xpos, ypos); 2312 this.doShowHide('hidden'); 2313 2314 } catch (e) { 2315 this.error(e); 2316 } 2317}, 2318 2319 2320afterClose : function () {
2321 this.a.className = this.a.className.replace('highslide-active-anchor', ''); 2322 2323 this.doShowHide('visible'); 2324 2325 if (this.isHtml && this.preserveContent) { 2326 this.sleep(); 2327 } else { 2328 if (this.outline && this.outlineWhileAnimating) this.outline.destroy(); 2329 if (this.iframe && this.objectLoadTime != 'after') this.destroyObject(); 2330 hs.discardElement(this.wrapper); 2331 } 2332 if (hs.mask) hs.mask.style.display = 'none'; 2333 2334 hs.expanders[this.key] = null; 2335 hs.reOrder(); 2336} 2337 2338}; 2339 2340 2341// hs.Ajax object prototype 2342hs.Ajax = function (a, content, pre) { 2343 this.a = a; 2344 this.content = content; 2345 this.pre = pre; 2346}; 2347 2348hs.Ajax.prototype = { 2349run : function () { 2350 var xhr; 2351 if (!this.src) this.src = hs.getSrc(this.a); 2352 if (this.src.match('#')) { 2353 var arr = this.src.split('#'); 2354 this.src = arr[0]; 2355 this.id = arr[1]; 2356 } 2357 if (hs.cachedGets[this.src]) { 2358 this.cachedGet = hs.cachedGets[this.src]; 2359 if (this.id) this.getElementContent(); 2360 else this.loadHTML(); 2361 return; 2362 } 2363 try { xhr = new XMLHttpRequest(); } 2364 catch (e) { 2365 try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } 2366 catch (e) { 2367 try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } 2368 catch (e) { this.onError(); } 2369 } 2370 } 2371 var pThis = this; 2372 xhr.onreadystatechange = function() { 2373 if(pThis.xhr.readyState == 4) { 2374 if (pThis.id) pThis.getElementContent(); 2375 else pThis.loadHTML(); 2376 } 2377 }; 2378 var src = this.src; 2379 this.xhr = xhr; 2380 if (hs.forceAjaxReload) 2381 src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime()); 2382 xhr.open('GET', src, true); 2383 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 2384 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 2385 xhr.send(null); 2386}, 2387 2388getElementContent : function() { 2389 hs.init(); 2390 var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null; 2391 2392 this.iframe = hs.createElement('iframe', attribs, 2393 { position: 'absolute', top: '-9999px' }, hs.container); 2394 2395 this.loadHTML(); 2396}, 2397 2398loadHTML : function() { 2399 var s = this.cachedGet || this.xhr.responseText, 2400 regBody; 2401 if (this.pre) hs.cachedGets[this.src] = s; 2402 if (!hs.ie || hs.uaVersion >= 5.5) { 2403 s = s.replace(new RegExp('<link[^>]*>', 'gi'), '') 2404 .replace(new RegExp('<script[^>]*>.*?</script>', 'gi'), ''); 2405 if (this.iframe) { 2406 var doc = this.iframe.contentDocument; 2407 if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document; 2408 if (!doc) { // Opera 2409 var pThis = this; 2410 setTimeout(function() { pThis.loadHTML(); }, 25); 2411 return; 2412 } 2413 doc.open(); 2414 doc.write(s); 2415 doc.close(); 2416 try { s = doc.getElementById(this.id).innerHTML; } catch (e) { 2417 try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera 2418 } 2419 hs.discardElement(this.iframe); 2420 } else { 2421 regBody = /(<body[^>]*>|<\/body>)/ig; 2422 if (regBody.test(s)) s = s.split(regBody)[hs.ieLt9 ? 1 : 2]; 2423 2424 } 2425 } 2426 hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s; 2427 this.onLoad(); 2428 for (var x in this) this[x] = null; 2429} 2430}; 2431hs.langDefaults = hs.lang; 2432// history 2433var HsExpander = hs.Expander; 2434if (hs.ie && window == window.top) { 2435 (function () { 2436 try { 2437 document.documentElement.doScroll('left'); 2438 } catch (e) { 2439 setTimeout(arguments.callee, 50); 2440 return; 2441 } 2442 hs.ready(); 2443 })(); 2444} 2445hs.addEventListener(document, 'DOMContentLoaded', hs.ready); 2446hs.addEventListener(window, 'load', hs.ready); 2447 2448// set handlers 2449hs.addEventListener(document, 'ready', function() {
2450 if (hs.expandCursor) { 2451 var style = hs.createElement('style', { type: 'text/css' }, null, 2452 document.getElementsByTagName('HEAD')[0]), 2453 backCompat = document.compatMode == 'BackCompat'; 2454 2455 2456 function addRule(sel, dec) { 2457 if (hs.ie && (hs.uaVersion < 9 || backCompat)) { 2458 var last = document.styleSheets[document.styleSheets.length - 1]; 2459 if (typeof(last.addRule) == "object") last.addRule(sel, dec); 2460 } else { 2461 style.appendChild(document.createTextNode(sel + " {" + dec + "}")); 2462 } 2463 } 2464 function fix(prop) { 2465 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop + 2466 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );'; 2467 } 2468 if (hs.expandCursor) addRule ('.highslide img', 2469 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;'); 2470 } 2471}); 2472hs.addEventListener(window, 'resize', function() { 2473 hs.getPageSize(); 2474}); 2475hs.addEventListener(document, 'mousemove', function(e) { 2476 hs.mouse = { x: e.clientX, y: e.clientY }; 2477}); 2478hs.addEventListener(document, 'mousedown', hs.mouseClickHandler); 2479hs.addEventListener(document, 'mouseup', hs.mouseClickHandler); 2480 2481hs.addEventListener(document, 'ready', hs.getAnchors); 2482hs.addEventListener(window, 'load', hs.preloadImages); 2483hs.addEventListener(window, 'load', hs.preloadAjax); 2484}
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.