1var hs = { 2// Language strings 3lang : { 4 cssDirection: 'ltr', 5 loadingText : 'Loading...', 6 loadingTitle : 'Click to cancel', 7 focusTitle : 'Click to bring to front', 8 fullExpandTitle : 'Expand to actual size (f)', 9 creditsText : '<i></i>', 10 creditsTitle : ' ', 11 restoreTitle : 'Clicca per chiudere e muovere le immagini. Usa le frecce della tastiera per vedere le altre.' 12}, 13// See http://highslide.com/ref for examples of settings 14graphicsDir : 'highslide/graphics/', 15expandCursor : 'zoomin.cur', // null disables 16restoreCursor : 'zoomout.cur', // null disables 17expandDuration : 250, // milliseconds 18restoreDuration : 250, 19marginLeft : 15, 20marginRight : 15, 21marginTop : 15, 22marginBottom : 15, 23zIndexCounter : 1001, // adjust to other absolutely positioned elements 24loadingOpacity : 0.75, 25allowMultipleInstances: true, 26numberOfImagesToPreload : 5, 27outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 28outlineStartOffset : 3, // ends at 10 29padToMinWidth : false, // pad the popup width to make room for wide caption 30fullExpandPosition : 'bottom right', 31fullExpandOpacity : 1, 32showCredits : true, // you can set this to false if you want 33creditsHref : '', 34enableKeyListener : true, 35openerTagNames : ['a'], // Add more to allow slideshow indexing 36 37dragByHeading: true, 38minWidth: 115, 39minHeight: 115, 40allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight 41outlineType : 'drop-shadow', // set null to disable outlines 42wrapperClassName : 'highslide-wrapper', // for enhanced css-control 43// END OF YOUR SETTINGS 44 45 46// declare internal properties 47preloadTheseImages : [], 48continuePreloading: true, 49expanders : [], 50overrides : [ 51 'allowSizeReduction', 52 'useBox', 53 'outlineType', 54 'outlineWhileAnimating', 55 'captionId', 56 'captionText', 57 'captionEval', 58 'captionOverlay', 59 'headingId', 60 'headingText', 61 'headingEval', 62 'headingOverlay', 63 'dragByHeading', 64 65 'width', 66 'height', 67 68 'wrapperClassName', 69 'minWidth', 70 'minHeight', 71 'maxWidth', 72 'maxHeight', 73 'slideshowGroup', 74 'easing', 75 'easingClose', 76 'fadeInOut', 77 'src' 78], 79overlays : [], 80idCounter : 0, 81oPos : { 82 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'], 83 y: ['above', 'top', 'middle', 'bottom', 'below'] 84}, 85mouse: {}, 86headingOverlay: {}, 87captionOverlay: {}, 88faders : [], 89 90pendingOutlines : {}, 91clones : {}, 92ie : (document.all && !window.opera), 93safari : /Safari/.test(navigator.userAgent), 94geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent), 95 96$ : function (id) { 97 return document.getElementById(id); 98}, 99 100push : function (arr, val) { 101 arr[arr.length] = val; 102}, 103 104createElement : function (tag, attribs, styles, parent, nopad) { 105 var el = document.createElement(tag); 106 if (attribs) hs.setAttribs(el, attribs); 107 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0}); 108 if (styles) hs.setStyles(el, styles); 109 if (parent) parent.appendChild(el); 110 return el; 111}, 112 113setAttribs : function (el, attribs) { 114 for (var x in attribs) el[x] = attribs[x]; 115}, 116 117setStyles : function (el, styles) { 118 for (var x in styles) { 119 if (hs.ie && x == 'opacity') { 120 if (styles[x] > 0.99) el.style.removeAttribute('filter'); 121 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')'; 122 } 123 else el.style[x] = styles[x]; 124 } 125}, 126 127ieVersion : function () { 128 var arr = navigator.appVersion.split("MSIE"); 129 return arr[1] ? parseFloat(arr[1]) : null; 130}, 131 132getPageSize : function () { 133 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 134 ? d.documentElement : d.body; 135 136 var width = hs.ie ? iebody.clientWidth : 137 (d.documentElement.clientWidth || self.innerWidth), 138 height = hs.ie ? iebody.clientHeight : self.innerHeight; 139 140 return { 141 width: width, 142 height: height, 143 scrollLeft: hs.ie ? iebody.scrollLeft : pageXOffset, 144 scrollTop: hs.ie ? iebody.scrollTop : pageYOffset 145 } 146}, 147 148getPosition : function(el) { 149 var p = { x: el.offsetLeft, y: el.offsetTop }; 150 while (el.offsetParent) { 151 el = el.offsetParent; 152 p.x += el.offsetLeft; 153 p.y += el.offsetTop; 154 if (el != document.body && el != document.documentElement) { 155 p.x -= el.scrollLeft; 156 p.y -= el.scrollTop; 157 } 158 } 159 return p; 160}, 161 162expand : function(a, params, custom, type) { 163 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container); 164 if (typeof a.getParams == 'function') return params; 165 try { 166 new hs.Expander(a, params, custom); 167 return false; 168 } catch (e) { return true; } 169}, 170 171 172focusTopmost : function() { 173 var topZ = 0, topmostKey = -1; 174 for (var i = 0; i < hs.expanders.length; i++) {
175 if (hs.expanders[i]) { 176 if (hs.expanders[i].wrapper.style.zIndex && hs.expanders[i].wrapper.style.zIndex > topZ) { 177 topZ = hs.expanders[i].wrapper.style.zIndex; 178 179 topmostKey = i; 180 } 181 } 182 } 183 if (topmostKey == -1) hs.focusKey = -1; 184 else hs.expanders[topmostKey].focus(); 185}, 186 187getParam : function (a, param) { 188 a.getParams = a.onclick; 189 var p = a.getParams ? a.getParams() : null; 190 a.getParams = null; 191 192 return (p && typeof p[param] != 'undefined') ? p[param] : 193 (typeof hs[param] != 'undefined' ? hs[param] : null); 194}, 195 196getSrc : function (a) { 197 var src = hs.getParam(a, 'src'); 198 if (src) return src; 199 return a.href; 200}, 201 202getNode : function (id) { 203 var node = hs.$(id), clone = hs.clones[id], a = {}; 204 if (!node && !clone) return null; 205 if (!clone) { 206 clone = node.cloneNode(true); 207 clone.id = ''; 208 hs.clones[id] = clone; 209 return node; 210 } else { 211 return clone.cloneNode(true); 212 } 213}, 214 215discardElement : function(d) { 216 hs.garbageBin.appendChild(d); 217 hs.garbageBin.innerHTML = ''; 218}, 219transit : function (adj, exp) { 220 hs.last = exp = exp || hs.getExpander(); 221 try { 222 hs.upcoming = adj; 223 adj.onclick(); 224 } catch (e){ 225 hs.last = hs.upcoming = null; 226 } 227 try { 228 exp.close(); 229 } catch (e) {} 230 return false; 231}, 232 233previousOrNext : function (el, op) { 234 var exp = hs.getExpander(el), 235 adj = exp.getAdjacentAnchor(op); 236 return hs.transit(adj, exp); 237}, 238 239previous : function (el) { 240 return hs.previousOrNext(el, -1); 241}, 242 243next : function (el) { 244 return hs.previousOrNext(el, 1); 245}, 246 247keyHandler : function(e) { 248 if (!e) e = window.event; 249 if (!e.target) e.target = e.srcElement; // ie 250 if (typeof e.target.form != 'undefined') return true; // form element has focus 251 var exp = hs.getExpander(); 252 253 var op = null; 254 switch (e.keyCode) { 255 case 70: // f 256 if (exp) exp.doFullExpand(); 257 return true; 258 case 32: // Space 259 case 34: // Page Down 260 case 39: // Arrow right 261 case 40: // Arrow down 262 op = 1; 263 break; 264 case 8: // Backspace 265 case 33: // Page Up 266 case 37: // Arrow left 267 case 38: // Arrow up 268 op = -1; 269 break; 270 case 27: // Escape 271 case 13: // Enter 272 op = 0; 273 } 274 if (op !== null) {hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 275 if (!hs.enableKeyListener) return true; 276 277 if (e.preventDefault) e.preventDefault(); 278 else e.returnValue = false; 279 280 if (exp) { 281 if (op == 0) { 282 exp.close(); 283 } else { 284 hs.previousOrNext(exp.key, op); 285 } 286 return false; 287 } 288 } 289 return true; 290}, 291 292 293registerOverlay : function (overlay) { 294 hs.push(hs.overlays, overlay); 295}, 296 297 298getWrapperKey : function (element, expOnly) { 299 var el, re = /^highslide-wrapper-([0-9]+)$/; 300 // 1. look in open expanders 301 el = element; 302 while (el.parentNode) { 303 if (el.id && re.test(el.id)) return el.id.replace(re, "$1"); 304 el = el.parentNode; 305 } 306 // 2. look in thumbnail 307 if (!expOnly) { 308 el = element; 309 while (el.parentNode) { 310 if (el.tagName && hs.isHsAnchor(el)) { 311 for (var key = 0; key < hs.expanders.length; key++) { 312 var exp = hs.expanders[key]; 313 if (exp && exp.a == el) return key; 314 } 315 } 316 el = el.parentNode; 317 } 318 } 319 return null; 320}, 321 322getExpander : function (el, expOnly) { 323 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null; 324 if (typeof el == 'number') return hs.expanders[el] || null; 325 if (typeof el == 'string') el = hs.$(el); 326 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null; 327}, 328 329isHsAnchor : function (a) { 330 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/)); 331}, 332 333reOrder : function () { 334 for (var i = 0; i < hs.expanders.length; i++) 335 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost(); 336}, 337 338mouseClickHandler : function(e) 339{ 340 if (!e) e = window.event; 341 if (e.button > 1) return true; 342 if (!e.target) e.target = e.srcElement; 343 344 var el = e.target; 345 while (el.parentNode 346 && !(/highslide-(image|move|html|resize)/.test(el.className))) 347 { 348 el = el.parentNode; 349 } 350 var exp = hs.getExpander(el); 351 if (exp && (exp.isClosing || !exp.isExpanded)) return true; 352 353 if (exp && e.type == 'mousedown') { 354 if (e.target.form) return true; 355 var match = el.className.match(/highslide-(image|move|resize)/); 356 if (match) { 357 hs.dragArgs = { exp: exp , type: match[1], left: exp.x.pos, width: exp.x.size, top: exp.y.pos, 358 height: exp.y.size, clickX: e.clientX, clickY: e.clientY }; 359 360 361 hs.addEventListener(document, 'mousemove', hs.dragHandler); 362 if (e.preventDefault) e.preventDefault(); // FF 363 364 if (/highslide-(image|html)-blur/.test(exp.content.className)) { 365 exp.focus(); 366 hs.hasFocused = true; 367 } 368 return false; 369 } 370 } else if (e.type == 'mouseup') { 371 372 hs.removeEventListener(document, 'mousemove', hs.dragHandler); 373 374 if (hs.dragArgs) { 375 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 376 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor; 377 var hasDragged = hs.dragArgs.hasDragged; 378 379 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) { 380 exp.close(); 381 } 382 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) { 383 hs.dragArgs.exp.doShowHide('hidden'); 384 } 385 386 hs.hasFocused = false; 387 hs.dragArgs = null; 388 389 } else if (/highslide-image-blur/.test(el.className)) { 390 el.style.cursor = hs.styleRestoreCursor; 391 } 392 } 393 return false; 394}, 395 396dragHandler : function(e) 397{ 398 if (!hs.dragArgs) return true; 399 if (!e) e = window.event; 400 var a = hs.dragArgs, exp = a.exp; 401 402 a.dX = e.clientX - a.clickX;
403 a.dY = e.clientY - a.clickY; 404 405 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2)); 406 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0) 407 || (distance > (hs.dragSensitivity || 5)); 408 409 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) { 410 411 if (a.type == 'resize') exp.resize(a); 412 else { 413 exp.moveTo(a.left + a.dX, a.top + a.dY); 414 if (a.type == 'image') exp.content.style.cursor = 'move'; 415 } 416 } 417 return false; 418}, 419 420wrapperMouseHandler : function (e) { 421 try { 422 if (!e) e = window.event; 423 var over = /mouseover/i.test(e.type); 424 if (!e.target) e.target = e.srcElement; // ie 425 if (hs.ie) e.relatedTarget = 426 over ? e.fromElement : e.toElement; // ie 427 var exp = hs.getExpander(e.target); 428 if (!exp.isExpanded) return; 429 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 430 || hs.dragArgs) return; 431 for (var i = 0; i < exp.overlays.length; i++) { 432 var o = hs.$('hsId'+ exp.overlays[i]); 433 if (o && o.hideOnMouseOut) { 434 var from = over ? 0 : o.opacity, 435 to = over ? o.opacity : 0; 436 hs.fade(o, from, to); 437 } 438 } 439 } catch (e) {} 440}, 441 442addEventListener : function (el, event, func) { 443 try { 444 el.addEventListener(event, func, false); 445 } catch (e) { 446 try { 447 el.detachEvent('on'+ event, func); 448 el.attachEvent('on'+ event, func); 449 } catch (e) { 450 el['on'+ event] = func; 451 } 452 } 453}, 454 455removeEventListener : function (el, event, func) { 456 try { 457 el.removeEventListener(event, func, false); 458 } catch (e) { 459 try { 460 el.detachEvent('on'+ event, func); 461 } catch (e) { 462 el['on'+ event] = null; 463 } 464 } 465}, 466 467preloadFullImage : function (i) { 468 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') { 469 var img = document.createElement('img'); 470 img.onload = function() { 471 img = null; 472 hs.preloadFullImage(i + 1); 473 }; 474 img.src = hs.preloadTheseImages[i]; 475 } 476}, 477preloadImages : function (number) { 478 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number; 479 480 var arr = hs.getAnchors(); 481 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) { 482 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i])); 483 } 484 485 // preload outlines 486 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} ); 487 else 488 489 hs.preloadFullImage(0); 490 491 // preload cursor 492 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor }); 493}, 494 495 496init : function () { 497 if (!hs.container) { 498 hs.container = hs.createElement('div', { 499 className: 'highslide-container' 500 }, { 501 position: 'absolute', 502 left: 0, 503 top: 0, 504 width: '100%', 505 zIndex: hs.zIndexCounter, 506 direction: 'ltr' 507 }, 508 document.body, 509 true 510 ); 511 hs.loading = hs.createElement('a', { 512 className: 'highslide-loading', 513 title: hs.lang.loadingTitle, 514 innerHTML: hs.lang.loadingText, 515 href: 'javascript:;' 516 }, { 517 position: 'absolute', 518 top: '-9999px', 519 opacity: hs.loadingOpacity, 520 zIndex: 1 521 }, hs.container 522 ); 523 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container); 524 525 // http://www.robertpenner.com/easing/ 526 Math.linearTween = function (t, b, c, d) { 527 return c*t/d + b; 528 }; 529 Math.easeInQuad = function (t, b, c, d) { 530 return c*(t/=d)*t + b; 531 }; 532 for (var x in hs.langDefaults) { 533 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x]; 534 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 535 hs.lang[x] = hs.langDefaults[x]; 536 } 537 538 hs.hideSelects = (hs.ie && hs.ieVersion() < 7); 539 hs.hideIframes = ((window.opera && navigator.appVersion < 9) || navigator.vendor == 'KDE' 540 || (hs.ie && hs.ieVersion() < 5.5)); 541 } 542}, 543domReady : function() { 544 hs.isDomReady = true; 545 if (hs.onDomReady) hs.onDomReady(); 546}, 547 548updateAnchors : function() { 549 var el, els, all = [], images = [],groups = {}, re; 550 551 for (var i = 0; i < hs.openerTagNames.length; i++) { 552 els = document.getElementsByTagName(hs.openerTagNames[i]); 553 for (var j = 0; j < els.length; j++) { 554 el = els[j];
555 re = hs.isHsAnchor(el); 556 if (re) { 557 hs.push(all, el); 558 if (re[0] == 'hs.expand') hs.push(images, el); 559 var g = hs.getParam(el, 'slideshowGroup') || 'none'; 560 if (!groups[g]) groups[g] = []; 561 hs.push(groups[g], el); 562 } 563 } 564 } 565 hs.anchors = { all: all, groups: groups, images: images }; 566 return hs.anchors; 567 568}, 569 570getAnchors : function() { 571 return hs.anchors || hs.updateAnchors(); 572}, 573 574 575fade : function (el, o, oFinal, dur, fn, i, dir) { 576 if (typeof i == 'undefined') { // new fader 577 if (typeof dur != 'number') dur = 250; 578 if (dur < 25) { // instant 579 hs.setStyles( el, { opacity: oFinal }); 580 if (fn) fn(); 581 return; 582 } 583 i = hs.faders.length; 584 dir = oFinal > o ? 1 : -1; 585 var step = (25 / (dur - dur % 25)) * Math.abs(o - oFinal); 586 } 587 o = parseFloat(o); 588 var skip = (el.fade === 0 || el.fade === false || (el.fade == 2 && hs.ie)); 589 el.style.visibility = ((skip ? oFinal : o) <= 0) ? 'hidden' : 'visible'; 590 if (skip || o < 0 || (dir == 1 && o > oFinal)) { 591 if (fn) fn(); 592 return; 593 } 594 if (el.fading && el.fading.i != i) { 595 clearTimeout(hs.faders[el.fading.i]); 596 o = el.fading.o; 597 } 598 el.fading = {i: i, o: o, step: (step || el.fading.step)}; 599 el.style.visibility = (o <= 0) ? 'hidden' : 'visible'; 600 hs.setStyles(el, { opacity: o }); 601 hs.faders[i] = setTimeout(function() { 602 hs.fade(el, o + el.fading.step * dir, oFinal, null, fn, i, dir); 603 }, 25); 604}, 605 606close : function(el) { 607 var exp = hs.getExpander(el); 608 if (exp) exp.close(); 609 return false; 610} 611}; // end hs object 612 613 614hs.Outline = function (outlineType, onLoad) { 615 this.onLoad = onLoad; 616 this.outlineType = outlineType; 617 var v = hs.ieVersion(), tr; 618 619 this.hasAlphaImageLoader = hs.ie && v >= 5.5 && v < 7; 620 if (!outlineType) { 621 if (onLoad) onLoad(); 622 return; 623 } 624 625 hs.init(); 626 this.table = hs.createElement( 627 'table', { 628 cellSpacing: 0 629 }, { 630 visibility: 'hidden', 631 position: 'absolute', 632 borderCollapse: 'collapse', 633 width: 0 634 }, 635 hs.container, 636 true 637 ); 638 var tbody = hs.createElement('tbody', null, null, this.table, 1); 639 640 this.td = []; 641 for (var i = 0; i <= 8; i++) { 642 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true); 643 this.td[i] = hs.createElement('td', null, null, tr, true); 644 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' }; 645 hs.setStyles(this.td[i], style); 646 }
647 this.td[4].className = outlineType +' highslide-outline'; 648 649 this.preloadGraphic(); 650}; 651 652hs.Outline.prototype = { 653preloadGraphic : function () { 654 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png"; 655 656 var appendTo = hs.safari ? hs.container : null; 657 this.graphic = hs.createElement('img', null, { position: 'absolute', 658 top: '-9999px' }, appendTo, true); // for onload trigger 659 660 var pThis = this; 661 this.graphic.onload = function() { pThis.onGraphicLoad(); }; 662 663 this.graphic.src = src; 664}, 665 666onGraphicLoad : function () { 667 var o = this.offset = this.graphic.width / 4, 668 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]], 669 dim = { height: (2*o) +'px', width: (2*o) +'px' }; 670 for (var i = 0; i <= 8; i++) { 671 if (pos[i]) { 672 if (this.hasAlphaImageLoader) { 673 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px'; 674 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true); 675 hs.createElement ('div', null, { 676 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 677 position: 'absolute', 678 width: w, 679 height: this.graphic.height +'px', 680 left: (pos[i][0]*o)+'px', 681 top: (pos[i][1]*o)+'px' 682 }, 683 div, 684 true); 685 } else { 686 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'}); 687 } 688 689 if (window.opera && (i == 3 || i ==5)) 690 hs.createElement('div', null, dim, this.td[i], true); 691 692 hs.setStyles (this.td[i], dim); 693 } 694 } 695 this.graphic = null; 696 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy(); 697 hs.pendingOutlines[this.outlineType] = this; 698 if (this.onLoad) this.onLoad(); 699}, 700 701setPosition : function (exp, pos, vis) { 702 pos = pos || { 703 x: exp.x.pos, 704 y: exp.y.pos, 705 w: exp.x.size + exp.x.p1 + exp.x.p2, 706 h: exp.y.size + exp.y.p1 + exp.y.p2 707 }; 708 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 709 ? 'visible' : 'hidden'; 710 hs.setStyles(this.table, { 711 left: (pos.x - this.offset) +'px', 712 top: (pos.y - this.offset) +'px', 713 width: (pos.w + 2 * (exp.x.cb + this.offset)) +'px' 714 }); 715 716 pos.w += 2 * (exp.x.cb - this.offset); 717 pos.h += + 2 * (exp.y.cb - this.offset); 718 hs.setStyles (this.td[4], { 719 width: pos.w >= 0 ? pos.w +'px' : 0, 720 height: pos.h >= 0 ? pos.h +'px' : 0 721 }); 722 if (this.hasAlphaImageLoader) this.td[3].style.height 723 = this.td[5].style.height = this.td[4].style.height; 724}, 725 726destroy : function(hide) { 727 if (hide) this.table.style.visibility = 'hidden'; 728 else hs.discardElement(this.table); 729} 730}; 731 732hs.Dimension = function(exp, dim) { 733 this.exp = exp; 734 this.dim = dim; 735 this.ucwh = dim == 'x' ? 'Width' : 'Height'; 736 this.wh = this.ucwh.toLowerCase(); 737 this.uclt = dim == 'x' ? 'Left' : 'Top'; 738 this.lt = this.uclt.toLowerCase(); 739 this.ucrb = dim == 'x' ? 'Right' : 'Bottom'; 740 this.rb = this.ucrb.toLowerCase(); 741 this.p1 = this.p2 = 0; 742}; 743hs.Dimension.prototype = { 744get : function(key) { 745 switch (key) { 746 case 'loadingPos': 747 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2; 748 case 'wsize': 749 return this.size + 2 * this.cb + this.p1 + this.p2; 750 case 'fitsize': 751 return this.clientSize - this.marginMin - this.marginMax; 752 case 'opos': 753 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0); 754 case 'osize': 755 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0); 756 case 'imgPad': 757 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0; 758 759 } 760}, 761calcBorders: function() { 762 // correct for borders 763 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2; 764 this.marginMax = hs['margin'+ this.ucrb] + 2 * this.cb; 765}, 766calcThumb: function() { 767 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 768 this.exp.el['offset'+ this.ucwh]; 769 this.tpos = this.exp.tpos[this.dim]; 770 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2; 771 if (this.tpos == 0) { 772 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt]; 773 }; 774}, 775calcExpanded: function() { 776 var exp = this.exp; 777 this.justify = 'auto'; 778 779 780 // size and position 781 this.pos = this.tpos - this.cb + this.tb; 782 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full); 783 this.minSize = exp.allowSizeReduction ? 784 Math.min(exp['min'+ this.ucwh], this.full) :this.full; 785 if (exp.useBox) { 786 this.size = exp[this.wh]; 787 this.imgSize = this.full; 788 } 789 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth; 790 this.marginMin = hs['margin'+ this.uclt]; 791 this.scroll = hs.page['scroll'+ this.uclt]; 792 this.clientSize = hs.page[this.wh]; 793}, 794setSize: function(i) { 795 var exp = this.exp; 796 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) { 797 this.imgSize = i; 798 this.size = Math.max(this.size, this.imgSize); 799 exp.content.style[this.lt] = this.get('imgPad')+'px'; 800 } else 801 this.size = i; 802 803 exp.content.style[this.wh] = i +'px'; 804 exp.wrapper.style[this.wh] = this.get('wsize') +'px'; 805 if (exp.outline) exp.outline.setPosition(exp); 806 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true); 807}, 808setPos: function(i) { 809 this.pos = i; 810 this.exp.wrapper.style[this.lt] = i +'px'; 811 812 if (this.exp.outline) this.exp.outline.setPosition(this.exp); 813 814} 815}; 816 817hs.Expander = function(a, params, custom, contentType) { 818 if (document.readyState && hs.ie && !hs.isDomReady) { 819 hs.onDomReady = function() { 820 new hs.Expander(a, params, custom, contentType); 821 }; 822 return; 823 } 824 this.a = a; 825 this.custom = custom; 826 this.contentType = contentType || 'image'; 827 this.isImage = !this.isHtml; 828 829 hs.continuePreloading = false; 830 this.overlays = []; 831 hs.init(); 832 var key = this.key = hs.expanders.length; 833 834 // override inline parameters 835 for (var i = 0; i < hs.overrides.length; i++) { 836 var name = hs.overrides[i];
837 this[name] = params && typeof params[name] != 'undefined' ? 838 params[name] : hs[name]; 839 } 840 if (!this.src) this.src = a.href; 841 842 // get thumb 843 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a; 844 el = this.thumb = el.getElementsByTagName('img')[0] || el; 845 this.thumbsUserSetId = el.id || a.id; 846 847 // check if already open 848 for (var i = 0; i < hs.expanders.length; i++) { 849 if (hs.expanders[i] && hs.expanders[i].a == a) { 850 hs.expanders[i].focus(); 851 return false; 852 } 853 } 854 855 // cancel other 856 for (var i = 0; i < hs.expanders.length; i++) { 857 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) { 858 hs.expanders[i].cancelLoading(); 859 } 860 } 861 hs.expanders[this.key] = this; 862 if (!hs.allowMultipleInstances && !hs.upcoming) { 863 if (hs.expanders[key-1]) hs.expanders[key-1].close(); 864 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey]) 865 hs.expanders[hs.focusKey].close(); 866 } 867 868 // initiate metrics 869 this.el = el; 870 this.tpos = hs.getPosition(el); 871 hs.page = hs.getPageSize(); 872 var x = this.x = new hs.Dimension(this, 'x'); 873 x.calcThumb(); 874 var y = this.y = new hs.Dimension(this, 'y'); 875 y.calcThumb(); 876 877 // instanciate the wrapper 878 this.wrapper = hs.createElement( 879 'div', { 880 id: 'highslide-wrapper-'+ this.key, 881 className: this.wrapperClassName 882 }, { 883 visibility: 'hidden', 884 position: 'absolute', 885 zIndex: hs.zIndexCounter++ 886 }, null, true ); 887 888 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler; 889 if (this.contentType == 'image' && this.outlineWhileAnimating == 2) 890 this.outlineWhileAnimating = 0; 891 892 // get the outline 893 if (!this.outlineType) { 894 this[this.contentType +'Create'](); 895 896 } else if (hs.pendingOutlines[this.outlineType]) { 897 this.connectOutline(); 898 this[this.contentType +'Create'](); 899 900 } else { 901 this.showLoading(); 902 var exp = this; 903 new hs.Outline(this.outlineType, 904 function () { 905 exp.connectOutline(); 906 exp[exp.contentType +'Create'](); 907 } 908 ); 909 } 910 return true; 911}; 912 913hs.Expander.prototype = { 914 915connectOutline : function() { 916 var o = this.outline = hs.pendingOutlines[this.outlineType]; 917 o.table.style.zIndex = this.wrapper.style.zIndex; 918 hs.pendingOutlines[this.outlineType] = null; 919}, 920 921showLoading : function() { 922 if (this.onLoadStarted || this.loading) return; 923 924 this.loading = hs.loading; 925 var exp = this; 926 this.loading.onclick = function() { 927 exp.cancelLoading(); 928 }; 929 var exp = this, 930 l = this.x.get('loadingPos') +'px', 931 t = this.y.get('loadingPos') +'px'; 932 setTimeout(function () { 933 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })} 934 , 100); 935}, 936 937imageCreate : function() { 938 var exp = this; 939 940 var img = document.createElement('img'); 941 this.content = img; 942 img.onload = function () { 943 if (hs.expanders[exp.key]) exp.contentLoaded(); 944 }; 945 if (hs.blockRightClick) img.oncontextmenu = function() { return false; }; 946 img.className = 'highslide-image'; 947 hs.setStyles(img, { 948 visibility: 'hidden', 949 display: 'block', 950 position: 'absolute', 951 maxWidth: '9999px', 952 zIndex: 3 953 }); 954 img.title = hs.lang.restoreTitle; 955 if (hs.safari) hs.container.appendChild(img); 956 if (hs.ie && hs.flushImgSize) img.src = null; 957 img.src = this.src; 958 959 this.showLoading(); 960}, 961 962contentLoaded : function() { 963 try { 964 if (!this.content) return; 965 this.content.onload = null; 966 if (this.onLoadStarted) return; 967 else this.onLoadStarted = true; 968 969 var x = this.x, y = this.y; 970 971 if (this.loading) { 972 hs.setStyles(this.loading, { top: '-9999px' }); 973 this.loading = null; 974 } 975 976 hs.setStyles (this.wrapper, { 977 left: x.tpos +'px', 978 top: y.tpos +'px' 979 }); 980 x.full = this.content.width; 981 y.full = this.content.height; 982 983 hs.setStyles(this.content, { 984 width: this.x.t +'px', 985 height: this.y.t +'px' 986 }); 987 this.wrapper.appendChild(this.content); 988 hs.container.appendChild(this.wrapper); 989 990 x.calcBorders(); 991 y.calcBorders(); 992 this.getOverlays(); 993 994 var ratio = x.full / y.full; 995 996 x.calcExpanded(); 997 this.justify(x); 998 999 y.calcExpanded(); 1000 this.justify(y); 1001 if (this.overlayBox) this.sizeOverlayBox(0, 1); 1002 1003 if (this.allowSizeReduction) { 1004 this.correctRatio(ratio); 1005 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) { 1006 this.createFullExpand(); 1007 if (this.overlays.length == 1) this.sizeOverlayBox(); 1008 } 1009 } 1010 this.show(); 1011 1012 } catch (e) { 1013 window.location.href = this.src; 1014 } 1015}, 1016 1017justify : function (p, moveOnly) { 1018 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y'; 1019 1020 var hasMovedMin = false; 1021 1022 var allowReduce = p.exp.allowSizeReduction; 1023 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2)); 1024 if (p.pos < p.scroll + p.marginMin) { 1025 p.pos = p.scroll + p.marginMin; 1026 hasMovedMin = true; 1027 } 1028 if (!moveOnly && p.size < p.minSize) { 1029 p.size = p.minSize; 1030 allowReduce = false; 1031 } 1032 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) { 1033 if (!moveOnly && hasMovedMin && allowReduce) { 1034 p.size = p.get('fitsize')- 2 * p.cb - p.p1 - p.p2; // can't expand more 1035 } else if (p.get('wsize') < p.get('fitsize')) { 1036 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize'); 1037 } else { // image larger than viewport 1038 p.pos = p.scroll + p.marginMin; 1039 if (!moveOnly && allowReduce) p.size = p.get('fitsize')- 2 * p.cb - p.p1 - p.p2; 1040 } 1041 } 1042 1043 if (!moveOnly && p.size < p.minSize) { 1044 p.size = p.minSize; 1045 allowReduce = false; 1046 } 1047 1048 1049 1050 if (p.pos < p.marginMin) { 1051 var tmpMin = p.pos; 1052 p.pos = p.marginMin; 1053 1054 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin); 1055 1056 } 1057}, 1058
1059correctRatio : function(ratio) { 1060 var x = this.x, 1061 y = this.y, 1062 changed = false, 1063 xSize = Math.min(x.full, x.size), 1064 ySize = Math.min(y.full, y.size), 1065 useBox = (this.useBox || hs.padToMinWidth); 1066 1067 if (xSize / ySize > ratio) { // width greater 1068 xSize = ySize * ratio; 1069 if (xSize < x.minSize) { // below minWidth 1070 xSize = x.minSize; 1071 ySize = xSize / ratio; 1072 } 1073 changed = true; 1074 1075 } else if (xSize / ySize < ratio) { // height greater 1076 ySize = xSize / ratio; 1077 changed = true; 1078 } 1079 1080 if (hs.padToMinWidth && x.full < x.minSize) { 1081 x.imgSize = x.full; 1082 y.size = y.imgSize = y.full; 1083 } else if (this.useBox) { 1084 x.imgSize = xSize; 1085 y.imgSize = ySize; 1086 } else { 1087 x.size = xSize; 1088 y.size = ySize; 1089 } 1090 this.fitOverlayBox(useBox ? null : ratio); 1091 if (useBox && y.size < y.imgSize) { 1092 y.imgSize = y.size; 1093 x.imgSize = y.size * ratio; 1094 } 1095 if (changed || useBox) { 1096 x.pos = x.tpos - x.cb + x.tb; 1097 x.minSize = x.size; 1098 this.justify(x, true); 1099 1100 y.pos = y.tpos - y.cb + y.tb; 1101 y.minSize = y.size; 1102 this.justify(y, true); 1103 if (this.overlayBox) this.sizeOverlayBox(); 1104 } 1105}, 1106fitOverlayBox : function(ratio) { 1107 var x = this.x, y = this.y; 1108 if (this.overlayBox) { 1109 while (y.size > this.minHeight && x.size > this.minWidth 1110 && y.get('wsize') > y.get('fitsize')) { 1111 y.size -= 10; 1112 if (ratio) x.size = y.size * ratio; 1113 this.sizeOverlayBox(0, 1); 1114 } 1115 } 1116}, 1117 1118show : function () { 1119 this.doShowHide('hidden'); 1120 // Apply size change 1121 this.changeSize( 1122 1, 1123 { 1124 xpos: this.x.tpos + this.x.tb - this.x.cb, 1125 ypos: this.y.tpos + this.y.tb - this.y.cb, 1126 xsize: this.x.t, 1127 ysize: this.y.t, 1128 xp1: 0, 1129 xp2: 0, 1130 yp1: 0, 1131 yp2: 0, 1132 ximgSize: this.x.t, 1133 ximgPad: 0, 1134 yimgSize: this.y.t, 1135 yimgPad: 0, 1136 o: hs.outlineStartOffset 1137 }, 1138 { 1139 xpos: this.x.pos, 1140 ypos: this.y.pos, 1141 xsize: this.x.size, 1142 ysize: this.y.size, 1143 xp1: this.x.p1, 1144 yp1: this.y.p1, 1145 xp2: this.x.p2, 1146 yp2: this.y.p2, 1147 ximgSize: this.x.imgSize, 1148 ximgPad: this.x.get('imgPad'), 1149 yimgSize: this.y.imgSize, 1150 yimgPad: this.y.get('imgPad'), 1151 o: this.outline ? this.outline.offset : 0 1152 }, 1153 hs.expandDuration 1154 ); 1155}, 1156 1157changeSize : function(up, from, to, dur) { 1158 1159 if (this.outline && !this.outlineWhileAnimating) { 1160 if (up) this.outline.setPosition(this); 1161 else this.outline.destroy(); 1162 } 1163 1164 1165 if (!up && this.overlayBox) { 1166 hs.discardElement(this.overlayBox); 1167 } 1168 if (this.fadeInOut) { 1169 from.op = up ? 0 : 1; 1170 to.op = up; 1171 } 1172 var t, 1173 exp = this, 1174 easing = Math[this.easing] || Math.easeInQuad, 1175 steps = (up ? hs.expandSteps : hs.restoreSteps) || parseInt(dur / 25) || 1; 1176 if (!up) easing = Math[this.easingClose] || easing; 1177 for (var i = 1; i <= steps ; i++) { 1178 t = Math.round(i * (dur / steps)); 1179 1180 (function(){ 1181 var pI = i, size = {}; 1182 1183 for (var x in from) { 1184 size[x] = easing(t, from[x], to[x] - from[x], dur); 1185 if (isNaN(size[x])) size[x] = to[x]; 1186 if (!/^op$/.test(x)) size[x] = Math.round(size[x]); 1187 } 1188 setTimeout ( function() { 1189 if (up && pI == 1) { 1190 exp.content.style.visibility = 'visible'; 1191 exp.a.className += ' highslide-active-anchor'; 1192 } 1193 exp.setSize(size); 1194 }, t); 1195 })(); 1196 } 1197 1198 if (up) { 1199 1200 setTimeout(function() { 1201 if (exp.outline) exp.outline.table.style.visibility = "visible"; 1202 }, t); 1203 setTimeout(function() { 1204 exp.afterExpand(); 1205 }, t + 50); 1206 } 1207 else setTimeout(function() { exp.afterClose(); }, t); 1208}, 1209 1210setSize : function (to) { 1211 try { 1212 if (to.op) hs.setStyles(this.wrapper, { opacity: to.op }); 1213 hs.setStyles ( this.wrapper, { 1214 width : (to.xsize +to.xp1 + to.xp2 + 1215 2 * this.x.cb) +'px', 1216 height : (to.ysize +to.yp1 + to.yp2 + 1217 2 * this.y.cb) +'px', 1218 left: to.xpos +'px', 1219 top: to.ypos +'px' 1220 }); 1221 hs.setStyles(this.content, { 1222 left: (to.xp1 + to.ximgPad) +'px', 1223 top: (to.yp1 + to.yimgPad) +'px', 1224 width: (to.ximgSize ||to.xsize) +'px', 1225 height: (to.yimgSize ||to.ysize) +'px' 1226 }); 1227 1228 if (this.outline && this.outlineWhileAnimating) { 1229 var o = this.outline.offset - to.o; 1230 this.outline.setPosition(this, { 1231 x: to.xpos + o, 1232 y: to.ypos + o, 1233 w: to.xsize + to.xp1 + to.xp2 + - 2 * o, 1234 h: to.ysize + to.yp1 + to.yp2 + - 2 * o 1235 }, 1); 1236 } 1237 1238 this.wrapper.style.visibility = 'visible'; 1239 1240 } catch (e) { 1241 window.location.href = this.src; 1242 } 1243}, 1244 1245 1246afterExpand : function() { 1247 this.isExpanded = true; 1248 this.focus(); 1249 this.prepareNextOutline(); 1250 1251
1252 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop; 1253 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize') 1254 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); 1255 1256 if (this.overlayBox) this.showOverlays(); 1257 1258}, 1259 1260 1261prepareNextOutline : function() { 1262 var key = this.key; 1263 var outlineType = this.outlineType; 1264 new hs.Outline(outlineType, 1265 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} }); 1266}, 1267 1268 1269preloadNext : function() { 1270 var next = this.getAdjacentAnchor(1); 1271 if (next && next.onclick.toString().match(/hs\.expand/)) 1272 var img = hs.createElement('img', { src: hs.getSrc(next) }); 1273}, 1274 1275 1276getAdjacentAnchor : function(op) { 1277 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none']; 1278 1279 /*< ? if ($cfg->slideshow) : ?>s*/ 1280 if (!as[current + op] && this.slideshow && this.slideshow.repeat) { 1281 if (op == 1) return as[0]; 1282 else if (op == -1) return as[as.length-1]; 1283 } 1284 /*< ? endif ?>s*/ 1285 return as[current + op] || null; 1286}, 1287 1288getAnchorIndex : function() { 1289 var arr = hs.anchors.groups[this.slideshowGroup || 'none']; 1290 for (var i = 0; i < arr.length; i++) { 1291 if (arr[i] == this.a) return i; 1292 } 1293 return null; 1294}, 1295 1296 1297cancelLoading : function() { 1298 hs.expanders[this.key] = null; 1299 if (this.loading) hs.loading.style.left = '-9999px'; 1300}, 1301 1302writeCredits : function () { 1303 this.credits = hs.createElement('a', { 1304 href: hs.creditsHref, 1305 className: 'highslide-credits', 1306 innerHTML: hs.lang.creditsText, 1307 title: hs.lang.creditsTitle 1308 }); 1309 this.createOverlay({ 1310 overlayId: this.credits, 1311 position: 'top left' 1312 }); 1313}, 1314 1315getInline : function(types, addOverlay) { 1316 for (var i = 0; i < types.length; i++) { 1317 var type = types[i], s = null; 1318 if (!this[type +'Id'] && this.thumbsUserSetId) 1319 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId; 1320 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']); 1321 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try { 1322 s = eval(this[type +'Eval']); 1323 } catch (e) {} 1324 if (!this[type] && this[type +'Text']) { 1325 s = this[type +'Text']; 1326 } 1327 if (!this[type] && !s) { 1328 var next = this.a.nextSibling; 1329 while (next && !hs.isHsAnchor(next)) { 1330 if ((new RegExp('highslide-'+ type)).test(next.className || null)) { 1331 this[type] = next.cloneNode(1); 1332 break; 1333 } 1334 next = next.nextSibling; 1335 } 1336 } 1337 1338 if (!this[type] && s) this[type] = hs.createElement('div', 1339 { className: 'highslide-'+ type, innerHTML: s } ); 1340 1341 if (addOverlay && this[type]) { 1342 var o = { position: (type == 'heading') ? 'above' : 'below' }; 1343 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x]; 1344 o.overlayId = this[type]; 1345 this.createOverlay(o); 1346 } 1347 } 1348}, 1349 1350 1351// on end move and resize 1352doShowHide : function(visibility) { 1353 if (hs.hideSelects) this.showHideElements('SELECT', visibility); 1354 if (hs.hideIframes) this.showHideElements('IFRAME', visibility); 1355 if (hs.geckoMac) this.showHideElements('*', visibility); 1356}, 1357showHideElements : function (tagName, visibility) { 1358 var els = document.getElementsByTagName(tagName); 1359 var prop = tagName == '*' ? 'overflow' : 'visibility'; 1360 for (var i = 0; i < els.length; i++) { 1361 if (prop == 'visibility' || (document.defaultView.getComputedStyle( 1362 els[i], "").getPropertyValue('overflow') == 'auto' 1363 || els[i].getAttribute('hidden-by') != null)) { 1364 var hiddenBy = els[i].getAttribute('hidden-by'); 1365 if (visibility == 'visible' && hiddenBy) { 1366 hiddenBy = hiddenBy.replace('['+ this.key +']', ''); 1367 els[i].setAttribute('hidden-by', hiddenBy); 1368 if (!hiddenBy) els[i].style[prop] = els[i].origProp; 1369 } else if (visibility == 'hidden') { // hide if behind 1370 var elPos = hs.getPosition(els[i]); 1371 elPos.w = els[i].offsetWidth; 1372 elPos.h = els[i].offsetHeight; 1373 1374 1375 var clearsX = (elPos.x + elPos.w < this.x.get('opos') 1376 || elPos.x > this.x.get('opos') + this.x.get('osize')); 1377 var clearsY = (elPos.y + elPos.h < this.y.get('opos') 1378 || elPos.y > this.y.get('opos') + this.y.get('osize'));
1379 var wrapperKey = hs.getWrapperKey(els[i]); 1380 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image 1381 if (!hiddenBy) { 1382 els[i].setAttribute('hidden-by', '['+ this.key +']'); 1383 els[i].origProp = els[i].style[prop]; 1384 els[i].style[prop] = 'hidden'; 1385 1386 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) { 1387 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']'); 1388 } 1389 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey) 1390 && wrapperKey != this.key) { // on move 1391 els[i].setAttribute('hidden-by', ''); 1392 els[i].style[prop] = els[i].origProp || ''; 1393 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) { 1394 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', '')); 1395 } 1396 1397 } 1398 } 1399 } 1400}, 1401 1402focus : function() { 1403 this.wrapper.style.zIndex = hs.zIndexCounter++; 1404 // blur others 1405 for (var i = 0; i < hs.expanders.length; i++) { 1406 if (hs.expanders[i] && i == hs.focusKey) { 1407 var blurExp = hs.expanders[i]; 1408 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur'; 1409 blurExp.content.style.cursor = hs.ie ? 'hand' : 'pointer'; 1410 blurExp.content.title = hs.lang.focusTitle; 1411 } 1412 } 1413 1414 // focus this 1415 if (this.outline) this.outline.table.style.zIndex 1416 = this.wrapper.style.zIndex; 1417 this.content.className = 'highslide-'+ this.contentType; 1418 this.content.title = hs.lang.restoreTitle; 1419 1420 if (hs.restoreCursor) { 1421 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer'; 1422 if (hs.ie && hs.ieVersion() < 6) hs.styleRestoreCursor = 'hand'; 1423 this.content.style.cursor = hs.styleRestoreCursor; 1424 } 1425 1426 hs.focusKey = this.key; 1427 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1428}, 1429moveTo: function(x, y) { 1430 this.x.setPos(x); 1431 this.y.setPos(y); 1432}, 1433resize : function (e) { 1434 var w, h, r = e.width / e.height; 1435 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full)); 1436 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full; 1437 h = w / r; 1438 if (h < Math.min(this.minHeight, this.y.full)) { 1439 h = Math.min(this.minHeight, this.y.full); 1440 if (this.isImage) w = h * r; 1441 } 1442 this.resizeTo(w, h); 1443}, 1444resizeTo: function(w, h) { 1445 this.y.setSize(h); 1446 this.x.setSize(w); 1447}, 1448 1449close : function() { 1450 if (this.isClosing || !this.isExpanded) return; 1451 this.isClosing = true; 1452 1453 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 1454 1455 try { 1456 this.content.style.cursor = 'default'; 1457 this.changeSize( 1458 0, { 1459 xpos: this.x.pos, 1460 ypos: this.y.pos, 1461 xsize: this.x.size, 1462 ysize: this.y.size, 1463 xp1: this.x.p1, 1464 yp1: this.y.p1, 1465 xp2: this.x.p2, 1466 yp2: this.y.p2, 1467 ximgSize: this.x.imgSize, 1468 ximgPad: this.x.get('imgPad'), 1469 yimgSize: this.y.imgSize, 1470 yimgPad: this.y.get('imgPad'), 1471 o: this.outline ? this.outline.offset : 0 1472 }, { 1473 xpos: this.x.tpos - this.x.cb + this.x.tb, 1474 ypos: this.y.tpos - this.y.cb + this.y.tb, 1475 xsize: this.x.t, 1476 ysize: this.y.t, 1477 xp1: 0, 1478 yp1: 0, 1479 xp2: 0, 1480 yp2: 0, 1481 ximgSize: this.x.imgSize ? this.x.t : null, 1482 ximgPad: 0, 1483 yimgSize: this.y.imgSize ? this.y.t : null, 1484 yimgPad: 0, 1485 o: hs.outlineStartOffset 1486 }, 1487 hs.restoreDuration 1488 ); 1489 1490 } catch (e) { this.afterClose(); } 1491}, 1492 1493createOverlay : function (o) { 1494 var el = o.overlayId; 1495 if (typeof el == 'string') el = hs.getNode(el); 1496 if (!el || typeof el == 'string') return; 1497 el.style.display = 'block'; 1498 this.genOverlayBox(); 1499 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto'; 1500 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px'; 1501 1502 var overlay = hs.createElement( 1503 'div', { 1504 id: 'hsId'+ hs.idCounter++, hsId: o.hsId 1505 }, { 1506 position: 'absolute', 1507 visibility: 'hidden', 1508 width: width, 1509 direction: hs.lang.cssDirection || '' 1510 }, 1511 this.overlayBox, 1512 true 1513 ); 1514 1515 overlay.appendChild(el); 1516 hs.setAttribs(overlay, { 1517 hideOnMouseOut: o.hideOnMouseOut, 1518 opacity: o.opacity || 1, 1519 hsPos: o.position, 1520 fade: o.fade 1521 }); 1522 1523 if (this.gotOverlays) { 1524 this.positionOverlay(overlay); 1525 if (!overlay.hideOnMouseOut || this.mouseIsOver) hs.fade(overlay, 0, overlay.opacity); 1526 } 1527 hs.push(this.overlays, hs.idCounter - 1); 1528}, 1529positionOverlay : function(overlay) { 1530 var p = overlay.hsPos || 'middle center'; 1531 if (/left$/.test(p)) overlay.style.left = 0; 1532 if (/center$/.test(p)) hs.setStyles (overlay, { 1533 left: '50%', 1534 marginLeft: '-'+ Math.round(overlay.offsetWidth / 2) +'px' 1535 }); 1536 if (/right$/.test(p)) overlay.style.right = 0; 1537 1538 if (/^leftpanel$/.test(p)) { 1539 hs.setStyles(overlay, { 1540 right: '100%', 1541 marginRight: this.x.cb +'px', 1542 top: - this.y.cb +'px', 1543 bottom: - this.y.cb +'px', 1544 overflow: 'auto' 1545 }); 1546 this.x.p1 = overlay.offsetWidth; 1547 1548 } else if (/^rightpanel$/.test(p)) { 1549 hs.setStyles(overlay, { 1550 left: '100%', 1551 marginLeft: this.x.cb +'px', 1552 top: - this.y.cb +'px', 1553 bottom: - this.y.cb +'px', 1554 overflow: 'auto' 1555 }); 1556 this.x.p2 = overlay.offsetWidth; 1557 } 1558 if (/^top/.test(p)) overlay.style.top = 0; 1559 if (/^middle/.test(p)) hs.setStyles (overlay, { 1560 top: '50%', 1561 marginTop: '-'+ Math.round(overlay.offsetHeight / 2) +'px' 1562 }); 1563 if (/^bottom/.test(p)) overlay.style.bottom = 0; 1564 if (/^above$/.test(p)) { 1565 hs.setStyles(overlay, { 1566 left: (- this.x.p1 - this.x.cb) +'px', 1567 right: (- this.x.p2 - this.x.cb) +'px', 1568 bottom: '100%', 1569 marginBottom: this.y.cb +'px', 1570 width: 'auto' 1571 }); 1572 this.y.p1 = overlay.offsetHeight; 1573 1574 } else if (/^below$/.test(p)) { 1575 hs.setStyles(overlay, { 1576 position: 'relative', 1577 left: (- this.x.p1 - this.x.cb) +'px', 1578 right: (- this.x.p2 - this.x.cb) +'px', 1579 top: '100%', 1580 marginTop: this.y.cb +'px', 1581 width: 'auto' 1582 }); 1583 this.y.p2 = overlay.offsetHeight; 1584 overlay.style.position = 'absolute'; 1585 } 1586}, 1587 1588getOverlays : function() { 1589 this.getInline(['heading', 'caption'], true); 1590 if (this.heading && this.dragByHeading) this.heading.className += ' highsli
1590de-move'; 1591 if (hs.showCredits) this.writeCredits(); 1592 for (var i = 0; i < hs.overlays.length; i++) { 1593 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup; 1594 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId) 1595 || (sg && sg === this.slideshowGroup)) { 1596 this.createOverlay(o); 1597 } 1598 } 1599 var os = []; 1600 for (var i = 0; i < this.overlays.length; i++) { 1601 var o = hs.$('hsId'+ this.overlays[i]); 1602 if (/panel$/.test(o.hsPos)) this.positionOverlay(o); 1603 else hs.push(os, o); 1604 } 1605 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]); 1606 this.gotOverlays = true; 1607}, 1608genOverlayBox : function() { 1609 if (!this.overlayBox) this.overlayBox = hs.createElement ( 1610 'div', { 1611 className: this.wrapperClassName 1612 }, { 1613 position : 'absolute', 1614 width: this.x.size ? this.x.size +'px' : this.x.full +'px', 1615 height: 0, 1616 visibility : 'hidden', 1617 overflow : 'hidden', 1618 zIndex : hs.ie ? 4 : null 1619 }, 1620 hs.container, 1621 true 1622 ); 1623}, 1624sizeOverlayBox : function(doWrapper, doPanels) { 1625 hs.setStyles( this.overlayBox, { 1626 width: this.x.size +'px', 1627 height: this.y.size +'px' 1628 }); 1629 if (doWrapper || doPanels) { 1630 for (var i = 0; i < this.overlays.length; i++) { 1631 var o = hs.$('hsId'+ this.overlays[i]); 1632 var ie6 = (hs.ie && (hs.ieVersion() <= 6 || document.compatMode == 'BackCompat')); 1633 if (o && /^(above|below)$/.test(o.hsPos)) { 1634 if (ie6) { 1635 o.style.width = (this.overlayBox.offsetWidth + 2 * this.x.cb 1636 + this.x.p1 + this.x.p2) +'px'; 1637 } 1638 this.y[o.hsPos == 'above' ? 'p1' : 'p2'] = o.offsetHeight; 1639 } 1640 if (o && ie6 && /^(left|right)panel$/.test(o.hsPos)) { 1641 o.style.height = (this.overlayBox.offsetHeight + 2 * this.y.cb 1642 + this.y.p1 + this.y.p2) +'px'; 1643 } 1644 } 1645 } 1646 if (doWrapper) { 1647 hs.setStyles(this.content, { 1648 top: this.y.p1 +'px' 1649 }); 1650 hs.setStyles(this.overlayBox, { 1651 top: (this.y.p1 + this.y.cb) +'px' 1652 }); 1653 } 1654}, 1655 1656showOverlays : function() { 1657 var b = this.overlayBox; 1658 b.className = ''; 1659 hs.setStyles(b, { 1660 top: (this.y.p1 + this.y.cb) +'px', 1661 left: (this.x.p1 + this.x.cb) +'px', 1662 overflow : 'visible' 1663 }); 1664 if (hs.safari) b.style.visibility = 'visible'; 1665 this.wrapper.appendChild (b); 1666 for (var i = 0; i < this.overlays.length; i++) { 1667 var o = hs.$('hsId'+ this.overlays[i]); 1668 o.style.zIndex = 4; 1669 if (!o.hideOnMouseOut || this.mouseIsOver) hs.fade(o, 0, o.opacity); 1670 } 1671}, 1672 1673 1674 1675createFullExpand : function () { 1676 this.fullExpandLabel = hs.createElement( 1677 'a', { 1678 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();', 1679 title: hs.lang.fullExpandTitle, 1680 className: 'highslide-full-expand' 1681 } 1682 ); 1683 1684 this.createOverlay({ 1685 overlayId: this.fullExpandLabel, 1686 position: hs.fullExpandPosition, 1687 hideOnMouseOut: true, 1688 opacity: hs.fullExpandOpacity 1689 }); 1690}, 1691 1692doFullExpand : function () { 1693 try { 1694 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel); 1695 1696 this.focus(); 1697 var xSize = this.x.size; 1698 this.resizeTo(this.x.full, this.y.full); 1699 1700 var xpos = this.x.pos - (this.x.size - xSize) / 2; 1701 if (xpos < hs.marginLeft) xpos = hs.marginLeft; 1702 1703 this.moveTo(xpos, this.y.pos); 1704 this.doShowHide('hidden'); 1705 1706 } catch (e) { 1707 window.location.href = this.content.src; 1708 } 1709}, 1710 1711 1712afterClose : function () { 1713 this.a.className = this.a.className.replace('highslide-active-anchor', ''); 1714 1715 this.doShowHide('visible'); 1716 if (this.outline && this.outlineWhileAnimating) this.outline.destroy(); 1717 1718 hs.discardElement(this.wrapper); 1719 hs.expanders[this.key] = null; 1720 hs.reOrder(); 1721} 1722 1723}; 1724if (document.readyState && hs.ie) { 1725 (function () { 1726 try { 1727 document.documentElement.doScroll('left'); 1728 } catch (e) { 1729 setTimeout(arguments.callee, 50); 1730 return; 1731 } 1732 hs.domReady(); 1733 })(); 1734} 1735hs.langDefaults = hs.lang; 1736// history 1737var HsExpander = hs.Expander; 1738 1739// set handlers 1740hs.addEventListener(window, 'load', function() {
1741 if (hs.expandCursor) { 1742 var sel = '.highslide img', 1743 dec = 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;'; 1744 1745 var style = hs.createElement('style', { type: 'text/css' }, null, 1746 document.getElementsByTagName('HEAD')[0]); 1747 1748 if (!hs.ie) { 1749 style.appendChild(document.createTextNode(sel + " {" + dec + "}")); 1750 } else { 1751 var last = document.styleSheets[document.styleSheets.length - 1]; 1752 if (typeof(last.addRule) == "object") last.addRule(sel, dec); 1753 } 1754 } 1755}); 1756hs.addEventListener(document, 'mousemove', function(e) { 1757 hs.mouse = { x: e.clientX, y: e.clientY }; 1758}); 1759hs.addEventListener(document, 'mousedown', hs.mouseClickHandler); 1760hs.addEventListener(document, 'mouseup', hs.mouseClickHandler); 1761hs.addEventListener(window, 'load', hs.preloadImages);
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.