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