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