1/* 2 * Shadowbox.js, version 3.0.3 3 * http://shadowbox-js.com/ 4 * 5 * Copyright 2007-2010, Michael J. I. Jackson 6 * Date: 2011-05-14 06:45:24 +0000 7 */ 8(function(window, undefined) { 9 var S = { 10 version: "3.0.3" 11 }; 12 var ua = navigator.userAgent.toLowerCase(); 13 if (ua.indexOf("windows") > -1 || ua.indexOf("win32") > -1) { 14 S.isWindows = true 15 } else { 16 if (ua.indexOf("macintosh") > -1 || ua.indexOf("mac os x") > -1) { 17 S.isMac = true 18 } else { 19 if (ua.indexOf("linux") > -1) { 20 S.isLinux = true 21 } 22 } 23 } 24 S.isIE = ua.indexOf("msie") > -1; 25 S.isIE6 = ua.indexOf("msie 6") > -1; 26 S.isIE7 = ua.indexOf("msie 7") > -1; 27 S.isGecko = ua.indexOf("gecko") > -1 && ua.indexOf("safari") == -1; 28 S.isWebKit = ua.indexOf("applewebkit/") > -1; 29 var inlineId = /#(.+)$/, 30 galleryName = /^(light|shadow)box\[(.*?)\]/i, 31 inlineParam = /\s*([a-z_]*?)\s*=\s*(.+)\s*/, 32 fileExtension = /[0-9a-z]+$/i, 33 scriptPath = /(.+\/)shadowbox\.js/i; 34 var open = false, 35 initialized = false, 36 lastOptions = {}, 37 slideDelay = 0, 38 slideStart, slideTimer; 39 S.current = -1; 40 S.dimensions = null; 41 S.ease = function(state) { 42 return 1 + Math.pow(state - 1, 3) 43 }; 44 S.errorInfo = { 45 fla: { 46 name: "Flash", 47 url: "http://www.adobe.com/products/flashplayer/" 48 }, 49 qt: { 50 name: "QuickTime", 51 url: "http://www.apple.com/quicktime/download/" 52 }, 53 wmp: { 54 name: "Windows Media Player", 55 url: "http://www.microsoft.com/windows/windowsmedia/" 56 }, 57 f4m: { 58 name: "Flip4Mac", 59 url: "http://www.flip4mac.com/wmv_download.htm" 60 } 61 }; 62 S.gallery = []; 63 S.onReady = noop; 64 S.path = null; 65 S.player = null; 66 S.playerId = "sb-player"; 67 S.options = { 68 animate: true, 69 animateFade: true, 70 autoplayMovies: true, 71 continuous: false, 72 enableKeys: true, 73 flashParams: { 74 bgcolor: "#000000", 75 allowfullscreen: true 76 }, 77 flashVars: {}, 78 flashVersion: "9.0.115", 79 handleOversize: "resize", 80 handleUnsupported: "link", 81 onChange: noop, 82 onClose: noop, 83 onFinish: noop, 84 onOpen: noop, 85 showMovieControls: true, 86 skipSetup: false, 87 slideshowDelay: 0, 88 viewportPadding: 20 89 }; 90 S.getCurrent = function() { 91 return S.current > -1 ? S.gallery[S.current] : null 92 }; 93 S.hasNext = function() { 94 return S.gallery.length > 1 && (S.current != S.gallery.length - 1 || S.options.continuous) 95 }; 96 S.isOpen = function() { 97 return open 98 }; 99 S.isPaused = function() { 100 return slideTimer == "pause" 101 }; 102 S.applyOptions = function(options) { 103 lastOptions = apply({}, S.options); 104 apply(S.options, options) 105 }; 106 S.revertOptions = function() { 107 apply(S.options, lastOptions) 108 }; 109 S.init = function(options, callback) { 110 if (initialized) { 111 return 112 } 113 initialized = true; 114 if (S.skin.options) { 115 apply(S.options, S.skin.options) 116 } 117 if (options) { 118 apply(S.options, options) 119 } 120 if (!S.path) { 121 var path, scripts = document.getElementsByTagName("script"); 122 for (var i = 0, len = scripts.length; i < len; ++i) { 123 path = scriptPath.exec(scripts[i].src); 124 if (path) { 125 S.path = path[1]; 126 break 127 } 128 } 129 } 130 if (callback) { 131 S.onReady = callback 132 } 133 bindLoad() 134 }; 135 S.open = function(obj) { 136 if (open) { 137 return 138 } 139 var gc = S.makeGallery(obj); 140 S.gallery = gc[0]; 141 S.current = gc[1]; 142 obj = S.getCurrent(); 143 if (obj == null) { 144 return 145 } 146 S.applyOptions(obj.options || {}); 147 filterGallery(); 148 if (S.gallery.length) { 149 obj = S.getCurrent(); 150 if (S.options.onOpen(obj) === false) { 151 return 152 } 153 open = true; 154 S.skin.onOpen(obj, load) 155 } 156 }; 157 S.close = function() { 158 if (!open) { 159 return 160 } 161 open = false;
162 if (S.player) { 163 S.player.remove(); 164 S.player = null 165 } 166 if (typeof slideTimer == "number") { 167 clearTimeout(slideTimer); 168 slideTimer = null 169 } 170 slideDelay = 0; 171 listenKeys(false); 172 S.options.onClose(S.getCurrent()); 173 S.skin.onClose(); 174 S.revertOptions() 175 }; 176 S.play = function() { 177 if (!S.hasNext()) { 178 return 179 } 180 if (!slideDelay) { 181 slideDelay = S.options.slideshowDelay * 1000 182 } 183 if (slideDelay) { 184 slideStart = now(); 185 slideTimer = setTimeout(function() { 186 slideDelay = slideStart = 0; 187 S.next() 188 }, slideDelay); 189 if (S.skin.onPlay) { 190 S.skin.onPlay() 191 } 192 } 193 }; 194 S.pause = function() { 195 if (typeof slideTimer != "number") { 196 return 197 } 198 slideDelay = Math.max(0, slideDelay - (now() - slideStart)); 199 if (slideDelay) { 200 clearTimeout(slideTimer); 201 slideTimer = "pause"; 202 if (S.skin.onPause) { 203 S.skin.onPause() 204 } 205 } 206 }; 207 S.change = function(index) { 208 if (!(index in S.gallery)) { 209 if (S.options.continuous) { 210 index = (index < 0 ? S.gallery.length + index : 0); 211 if (!(index in S.gallery)) { 212 return 213 } 214 } else { 215 return 216 } 217 } 218 S.current = index; 219 if (typeof slideTimer == "number") { 220 clearTimeout(slideTimer); 221 slideTimer = null; 222 slideDelay = slideStart = 0 223 } 224 S.options.onChange(S.getCurrent()); 225 load(true) 226 }; 227 S.next = function() { 228 S.change(S.current + 1) 229 }; 230 S.previous = function() { 231 S.change(S.current - 1) 232 }; 233 S.setDimensions = function(height, width, maxHeight, maxWidth, topBottom, leftRight, padding, preserveAspect) { 234 var originalHeight = height, 235 originalWidth = width; 236 var extraHeight = 2 * padding + topBottom; 237 if (height + extraHeight > maxHeight) { 238 height = maxHeight - extraHeight 239 } 240 var extraWidth = 2 * padding + leftRight; 241 if (width + extraWidth > maxWidth) { 242 width = maxWidth - extraWidth 243 } 244 var changeHeight = (originalHeight - height) / originalHeight, 245 changeWidth = (originalWidth - width) / originalWidth, 246 oversized = (changeHeight > 0 || changeWidth > 0); 247 if (preserveAspect && oversized) { 248 if (changeHeight > changeWidth) { 249 width = Math.round((originalWidth / originalHeight) * height) 250 } else { 251 if (changeWidth > changeHeight) { 252 height = Math.round((originalHeight / originalWidth) * width) 253 } 254 } 255 } 256 S.dimensions = { 257 height: height + topBottom, 258 width: width + leftRight, 259 innerHeight: height, 260 innerWidth: width, 261 top: Math.floor((maxHeight - (height + extraHeight)) / 2 + padding), 262 left: Math.floor((maxWidth - (width + extraWidth)) / 2 + padding), 263 oversized: oversized 264 }; 265 return S.dimensions 266 }; 267 S.makeGallery = function(obj) { 268 var gallery = [], 269 current = -1; 270 if (typeof obj == "string") { 271 obj = [obj] 272 } 273 if (typeof obj.length == "number") { 274 each(obj, function(i, o) { 275 if (o.content) { 276 gallery[i] = o 277 } else { 278 gallery[i] = { 279 content: o 280 } 281 } 282 }); 283 current = 0 284 } else { 285 if (obj.tagName) { 286 var cacheObj = S.getCache(obj); 287 obj = cacheObj ? cacheObj : S.makeObject(obj) 288 } 289 if (obj.gallery) { 290 gallery = []; 291 var o; 292 for (var key in S.cache) { 293 o = S.cache[key]; 294 if (o.gallery && o.gallery == obj.gallery) { 295 if (current == -1 && o.content == obj.content) { 296 current = gallery.length 297 } 298 gallery.push(o) 299 } 300 } 301 if (current == -1) { 302 gallery.unshift(obj); 303 current = 0 304 } 305 } else { 306 gallery = [obj]; 307 current = 0 308 } 309 } 310 each(gallery, function(i, o) { 311 gallery[i] = apply({}, o) 312 }); 313 return [gallery, current] 314 }; 315 S.makeObject = function(link, options) { 316 var obj = { 317 content: link.href, 318 title: link.getAttribute("title") || "", 319 link: link 320 }; 321 if (options) { 322 options = apply({}, options); 323 each(["player", "title", "height", "width", "gallery"], function(i, o) { 324 if (typeof options[o] != "undefined") { 325 obj[o] = options[o]; 326 delete options[o] 327 } 328 }); 329 obj.options = options 330 } else { 331 obj.options = {} 332 } 333 if (!obj.player) { 334 obj.player = S.getPlayer(obj.content) 335 } 336 var rel = link.getAttribute("rel"); 337 if (rel) { 338 var match = rel.match(galleryName); 339 if (match) { 340 obj.gallery = escape(match[2]) 341 } 342 each(rel.split(";"), function(i, p) { 343 match = p.match(inlineParam); 344 if (match) { 345 obj[match[1]] = match[2] 346 } 347 }) 348 } 349 return obj 350 }; 351 S.getPlayer = function(content) { 352 if (content.indexOf("#") > -1 && content.indexOf(document.location.href) == 0) { 353 return "inline" 354 } 355 var q = content.indexOf("?"); 356 if (q > -1) { 357 content = content.substring(0, q) 358 } 359 var ext, m = content.match(fileExtension); 360 if (m) { 361 ext = m[0].toLowerCase() 362 } 363 if (ext) { 364 if (S.img && S.img.ext.indexOf(ext) > -1) { 365 return "img" 366 } 367 if (S.swf && S.swf.ext.indexOf(ext) > -1) { 368 return "swf" 369 } 370 if (S.flv && S.flv.ext.indexOf(ext) > -1) { 371 return "flv" 372 } 373 if (S.qt && S.qt.ext.indexOf(ext) > -1) { 374 if (S.wmp && S.wmp.ext.indexOf(ext) > -1) { 375 return "qtwmp" 376 } else { 377 return "qt" 378 } 379 } 380 if (S.wmp && S.wmp.ext.indexOf(ext) > -1) { 381 return "wmp" 382 } 383 } 384 return "iframe" 385 }; 386 387 function filterGallery() { 388 var err = S.errorInfo, 389 plugins = S.plugins, 390 obj, remove, needed, m, format, replace, inlineEl, flashVersion; 391 for (var i = 0; i < S.gallery.length; ++i) { 392 obj = S.gallery[i]; 393 remove = false;
394 needed = null; 395 switch (obj.player) { 396 case "flv": 397 case "swf": 398 if (!plugins.fla) { 399 needed = "fla" 400 } 401 break; 402 case "qt": 403 if (!plugins.qt) { 404 needed = "qt" 405 } 406 break; 407 case "wmp": 408 if (S.isMac) { 409 if (plugins.qt && plugins.f4m) { 410 obj.player = "qt" 411 } else { 412 needed = "qtf4m" 413 } 414 } else { 415 if (!plugins.wmp) { 416 needed = "wmp" 417 } 418 } 419 break; 420 case "qtwmp": 421 if (plugins.qt) { 422 obj.player = "qt" 423 } else { 424 if (plugins.wmp) { 425 obj.player = "wmp" 426 } else { 427 needed = "qtwmp" 428 } 429 } 430 break 431 } 432 if (needed) { 433 if (S.options.handleUnsupported == "link") { 434 switch (needed) { 435 case "qtf4m": 436 format = "shared"; 437 replace = [err.qt.url, err.qt.name, err.f4m.url, err.f4m.name]; 438 break; 439 case "qtwmp": 440 format = "either"; 441 replace = [err.qt.url, err.qt.name, err.wmp.url, err.wmp.name]; 442 break; 443 default: 444 format = "single"; 445 replace = [err[needed].url, err[needed].name] 446 } 447 obj.player = "html"; 448 obj.content = '<div class="sb-message">' + sprintf(S.lang.errors[format], replace) + "</div>" 449 } else { 450 remove = true 451 } 452 } else { 453 if (obj.player == "inline") { 454 m = inlineId.exec(obj.content); 455 if (m) { 456 inlineEl = get(m[1]); 457 if (inlineEl) { 458 obj.content = inlineEl.innerHTML 459 } else { 460 remove = true 461 } 462 } else { 463 remove = true 464 } 465 } else { 466 if (obj.player == "swf" || obj.player == "flv") { 467 flashVersion = (obj.options && obj.options.flashVersion) || S.options.flashVersion; 468 if (S.flash && !S.flash.hasFlashPlayerVersion(flashVersion)) { 469 obj.width = 310; 470 obj.height = 177 471 } 472 } 473 } 474 } 475 if (remove) { 476 S.gallery.splice(i, 1); 477 if (i < S.current) { 478 --S.current 479 } else { 480 if (i == S.current) { 481 S.current = i > 0 ? i - 1 : i 482 } 483 }--i 484 } 485 } 486 } 487 488 function listenKeys(on) { 489 if (!S.options.enableKeys) { 490 return 491 }(on ? addEvent : removeEvent)(document, "keydown", handleKey) 492 } 493 494 function handleKey(e) { 495 if (e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) { 496 return 497 } 498 var code = keyCode(e), 499 handler; 500 switch (code) { 501 case 81: 502 case 88: 503 case 27: 504 handler = S.close; 505 break; 506 case 37: 507 handler = S.previous; 508 break; 509 case 39: 510 handler = S.next; 511 break; 512 case 32: 513 handler = typeof slideTimer == "number" ? S.pause : S.play; 514 break 515 } 516 if (handler) { 517 preventDefault(e); 518 handler() 519 } 520 } 521 522 function load(changing) { 523 listenKeys(false); 524 var obj = S.getCurrent(); 525 var player = (obj.player == "inline" ? "html" : obj.player); 526 if (typeof S[player] != "function") { 527 throw "unknown player " + player 528 } 529 if (changing) { 530 S.player.remove(); 531 S.revertOptions(); 532 S.applyOptions(obj.options || {}) 533 } 534 S.player = new S[player](obj, S.playerId); 535 if (S.gallery.length > 1) { 536 var next = S.gallery[S.current + 1] || S.gallery[0]; 537 if (next.player == "img") { 538 var a = new Image(); 539 a.src = next.content 540 } 541 var prev = S.gallery[S.current - 1] || S.gallery[S.gallery.length - 1]; 542 if (prev.player == "img") { 543 var b = new Image(); 544 b.src = prev.content 545 } 546 } 547 S.skin.onLoad(changing, waitReady) 548 } 549 550 function waitReady() { 551 if (!open) { 552 return 553 } 554 if (typeof S.player.ready != "undefined") { 555 var timer = setInterval(function() { 556 if (open) { 557 if (S.player.ready) { 558 clearInterval(timer); 559 timer = null; 560 S.skin.onReady(show) 561 } 562 } else { 563 clearInterval(timer); 564 timer = null 565 } 566 }, 10) 567 } else { 568 S.skin.onReady(show) 569 } 570 } 571 572 function show() { 573 if (!open) { 574 return 575 } 576 S.player.append(S.skin.body, S.dimensions); 577 S.skin.onShow(finish) 578 } 579 580 function finish() { 581 if (!open) { 582 return 583 } 584 if (S.player.onLoad) { 585 S.player.onLoad() 586 } 587 S.options.onFinish(S.getCurrent()); 588 if (!S.isPaused()) { 589 S.play() 590 } 591 listenKeys(true) 592 } 593 if (!Array.prototype.indexOf) { 594 Array.prototype.indexOf = function(obj, from) { 595 var len = this.length >>> 0; 596 from = from || 0; 597 if (from < 0) { 598 from += len 599 } 600 for (; from < len; ++from) { 601 if (from in this && this[from] === obj) { 602 return from 603 } 604 } 605 return -1 606 } 607 } 608 609 function now() { 610 return (new Date).getTime() 611 } 612 613 function apply(original, extension) { 614 for (var property in extension) { 615 original[property] = extension[property] 616 } 617 return original 618 } 619 620 function each(obj, callback) { 621 var i = 0, 622 len = obj.length; 623 for (var value = obj[0]; i < len && callback.call(value, i, value) !== false; value = obj[++i]) {} 624 } 625 626 function sprintf(str, replace) { 627 return str.replace(/\{(\w+?)\}/g, function(match, i) { 628 return replace[i] 629 }) 630 } 631 632 function noop() {} 633 634 function get(id) { 635 return document.getElementById(id) 636 } 637 638 function remove(el) { 639 el.parentNode.removeChild(el) 640 } 641 var supportsOpacity = true, 642 supportsFixed = true; 643 644 function checkSupport() { 645 var body = document.body, 646 div = document.createElement("div"); 647 supportsOpacity = typeof div.style.opacity === "string"; 648 div.style.position = "fixed"; 649 div.style.margin = 0; 650 div.style.top = "20px"; 651 body.appendChild(div, body.firstChild); 652 supportsFixed = div.offsetTop == 20; 653 body.removeChild(div) 654 } 655 S.getStyle = (function() { 656 var opacity = /opacity=([^)]*)/, 657 getComputedStyle = document.defaultView && document.defaultView.getComputedStyle; 658 return function(el, style) { 659 var ret; 660 if (!supportsOpacity && style == "opacity" && el.currentStyle) { 661 ret = opacity.test(el.currentStyle.filter || "") ? (parseFloat(RegExp.$1) / 100) + "" : ""; 662 return ret === "" ? "1" : ret 663 } 664 if (getComputedStyle) { 665 var computedStyle = getComputedStyle(el, null); 666 if (computedStyle) { 667 ret = computedStyle[style] 668 } 669 if (style == "opacity" && ret == "") { 670 ret = "1" 671 } 672 } else { 673 ret = el.currentStyle[style] 674 } 675 return ret 676 } 677 })(); 678 S.appendHTML = function(el, html) { 679 if (el.insertAdjacentHTML) { 680 el.insertAdjacentHTML("BeforeEnd", html) 681 } else { 682 if (el.lastChild) { 683 var range = el.ownerDocument.createRange(); 684 range.setStartAfter(el.lastChild); 685 var frag = range.createContextualFragment(html); 686 el.appendChild(frag) 687 } else { 688 el.innerHTML = html 689 } 690 } 691 }; 692 S.getWindowSize = function(dimension) { 693 if (document.compatMode === "CSS1Compat") { 694 return document.documentElement["client" + dimension] 695 } 696 return document.body["client" + dimension] 697 }; 698 S.setOpacity = function(el, opacity) { 699 var style = el.style; 700 if (supportsOpacity) { 701 style.opacity = (opacity == 1 ? "" : opacity) 702 } else { 703 style.zoom = 1; 704 if (opacity == 1) { 705 if (typeof style.filter == "string" && (/alpha/i).test(style.filter)) { 706 style.filter = style.filter.replace(/\s*[\w\.]*alpha\([^\)]*\);?/gi, "") 707 } 708 } else { 709 style.filter = (style.filter || "").replace(/\s*[\w\.]*alpha\([^\)]*\)/gi, "") + " alpha(opacity=" + (opacity * 100) + ")" 710 } 711 } 712 }; 713 S.clearOpacity = function(el) { 714 S.setOpacity(el, 1) 715 }; 716 717 function getTarget(e) { 718 var target = e.target ? e.target : e.srcElement; 719 return target.nodeType == 3 ? target.parentNode : target 720 } 721 722 function getPageXY(e) { 723 var x = e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)), 724 y = e.pageY || (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); 725 return [x, y] 726 } 727 728 function preventDefault(e) { 729 e.preventDefault() 730 } 731 732 function keyCode(e) { 733 return e.which ? e.which : e.keyCode 734 } 735 736 function addEvent(el, type, handler) { 737 if (el.addEventListener) { 738 el.addEventListener(type, handler, false) 739 } else {
740 if (el.nodeType === 3 || el.nodeType === 8) { 741 return 742 } 743 if (el.setInterval && (el !== window && !el.frameElement)) { 744 el = window 745 } 746 if (!handler.__guid) { 747 handler.__guid = addEvent.guid++ 748 } 749 if (!el.events) { 750 el.events = {} 751 } 752 var handlers = el.events[type]; 753 if (!handlers) { 754 handlers = el.events[type] = {}; 755 if (el["on" + type]) { 756 handlers[0] = el["on" + type] 757 } 758 } 759 handlers[handler.__guid] = handler; 760 el["on" + type] = addEvent.handleEvent 761 } 762 } 763 addEvent.guid = 1; 764 addEvent.handleEvent = function(event) { 765 var result = true; 766 event = event || addEvent.fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event); 767 var handlers = this.events[event.type]; 768 for (var i in handlers) { 769 this.__handleEvent = handlers[i]; 770 if (this.__handleEvent(event) === false) { 771 result = false 772 } 773 } 774 return result 775 }; 776 addEvent.preventDefault = function() { 777 this.returnValue = false 778 }; 779 addEvent.stopPropagation = function() { 780 this.cancelBubble = true 781 }; 782 addEvent.fixEvent = function(e) { 783 e.preventDefault = addEvent.preventDefault; 784 e.stopPropagation = addEvent.stopPropagation; 785 return e 786 }; 787 788 function removeEvent(el, type, handler) { 789 if (el.removeEventListener) { 790 el.removeEventListener(type, handler, false) 791 } else { 792 if (el.events && el.events[type]) { 793 delete el.events[type][handler.__guid] 794 } 795 } 796 } 797 var loaded = false, 798 DOMContentLoaded; 799 if (document.addEventListener) { 800 DOMContentLoaded = function() { 801 document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false); 802 S.load() 803 } 804 } else { 805 if (document.attachEvent) { 806 DOMContentLoaded = function() { 807 if (document.readyState === "complete") { 808 document.detachEvent("onreadystatechange", DOMContentLoaded); 809 S.load() 810 } 811 } 812 } 813 } 814 815 function doScrollCheck() { 816 if (loaded) { 817 return 818 } 819 try { 820 document.documentElement.doScroll("left") 821 } catch (e) { 822 setTimeout(doScrollCheck, 1); 823 return 824 } 825 S.load() 826 } 827 828 function bindLoad() { 829 if (document.readyState === "complete") { 830 return S.load() 831 } 832 if (document.addEventListener) { 833 document.addEventListener("DOMContentLoaded", DOMContentLoaded, false); 834 window.addEventListener("load", S.load, false) 835 } else { 836 if (document.attachEvent) { 837 document.attachEvent("onreadystatechange", DOMContentLoaded); 838 window.attachEvent("onload", S.load); 839 var topLevel = false; 840 try { 841 topLevel = window.frameElement === null 842 } catch (e) {} 843 if (document.documentElement.doScroll && topLevel) { 844 doScrollCheck() 845 } 846 } 847 } 848 } 849 S.load = function() { 850 if (loaded) { 851 return 852 } 853 if (!document.body) { 854 return setTimeout(S.load, 13) 855 } 856 loaded = true; 857 checkSupport(); 858 S.onReady(); 859 if (!S.options.skipSetup) { 860 S.setup() 861 } 862 S.skin.init() 863 }; 864 S.plugins = {}; 865 if (navigator.plugins && navigator.plugins.length) { 866 var names = []; 867 each(navigator.plugins, function(i, p) { 868 names.push(p.name) 869 }); 870 names = names.join(","); 871 var f4m = names.indexOf("Flip4Mac") > -1; 872 S.plugins = { 873 fla: names.indexOf("Shockwave Flash") > -1, 874 qt: names.indexOf("QuickTime") > -1, 875 wmp: !f4m && names.indexOf("Windows Media") > -1, 876 f4m: f4m 877 } 878 } else { 879 var detectPlugin = function(name) { 880 var axo; 881 try { 882 axo = new ActiveXObject(name) 883 } catch (e) {} 884 return !!axo 885 }; 886 S.plugins = { 887 fla: detectPlugin("ShockwaveFlash.ShockwaveFlash"), 888 qt: detectPlugin("QuickTime.QuickTime"), 889 wmp: detectPlugin("wmplayer.ocx"), 890 f4m: false 891 } 892 } 893 var relAttr = /^(light|shadow)box/i, 894 expando = "shadowboxCacheKey", 895 cacheKey = 1; 896 S.cache = {}; 897 S.select = function(selector) { 898 var links = []; 899 if (!selector) { 900 var rel; 901 each(document.getElementsByTagName("a"), function(i, el) { 902 rel = el.getAttribute("rel"); 903 if (rel && relAttr.test(rel)) { 904 links.push(el) 905 } 906 }) 907 } else { 908 var length = selector.length; 909 if (length) { 910 if (typeof selector == "string") { 911 if (S.find) { 912 links = S.find(selector) 913 } 914 } else { 915 if (length == 2 && typeof selector[0] == "string" && selector[1].nodeType) { 916 if (S.find) { 917 links = S.find(selector[0], selector[1]) 918 } 919 } else { 920 for (var i = 0; i < length; ++i) { 921 links[i] = selector[i] 922 } 923 } 924 } 925 } else { 926 links.push(selector) 927 } 928 } 929 return links 930 }; 931 S.setup = function(selector, options) { 932 each(S.select(selector), function(i, link) { 933 S.addCache(link, options) 934 }) 935 }; 936 S.teardown = function(selector) { 937 each(S.select(selector), function(i, link) { 938 S.removeCache(link) 939 }) 940 }; 941 S.addCache = function(link, options) { 942 var key = link[expando]; 943 if (key == undefined) { 944 key = cacheKey++; 945 link[expando] = key; 946 addEvent(link, "click", handleClick) 947 } 948 S.cache[key] = S.makeObject(link, options) 949 }; 950 S.removeCache = function(link) { 951 removeEvent(link, "click", handleClick); 952 delete S.cache[link[expando]]; 953 link[expando] = null 954 }; 955 S.getCache = function(link) { 956 var key = link[expando]; 957 return (key in S.cache && S.cache[key]) 958 }; 959 S.clearCache = function() { 960 for (var key in S.cache) { 961 S.removeCache(S.cache[key].link) 962 } 963 S.cache = {} 964 }; 965 966 function handleClick(e) { 967 S.open(this); 968 if (S.gallery.length) { 969 preventDefault(e) 970 } 971 } 972 /* 973 * Sizzle CSS Selector Engine - v1.0
974 * Copyright 2009, The Dojo Foundation 975 * Released under the MIT, BSD, and GPL Licenses. 976 * More information: http://sizzlejs.com/ 977 * 978 * Modified for inclusion in Shadowbox.js 979 */ 980 S.find = (function() { 981 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 982 done = 0, 983 toString = Object.prototype.toString, 984 hasDuplicate = false, 985 baseHasDuplicate = true; 986 [0, 0].sort(function() { 987 baseHasDuplicate = false; 988 return 0 989 }); 990 var Sizzle = function(selector, context, results, seed) { 991 results = results || []; 992 var origContext = context = context || document; 993 if (context.nodeType !== 1 && context.nodeType !== 9) { 994 return [] 995 } 996 if (!selector || typeof selector !== "string") { 997 return results 998 } 999 var parts = [], 1000 m, set, checkSet, extra, prune = true, 1001 contextXML = isXML(context), 1002 soFar = selector; 1003 while ((chunker.exec(""), m = chunker.exec(soFar)) !== null) { 1004 soFar = m[3]; 1005 parts.push(m[1]); 1006 if (m[2]) { 1007 extra = m[3]; 1008 break 1009 } 1010 } 1011 if (parts.length > 1 && origPOS.exec(selector)) { 1012 if (parts.length === 2 && Expr.relative[parts[0]]) { 1013 set = posProcess(parts[0] + parts[1], context) 1014 } else { 1015 set = Expr.relative[parts[0]] ? [context] : Sizzle(parts.shift(), context); 1016 while (parts.length) { 1017 selector = parts.shift(); 1018 if (Expr.relative[selector]) { 1019 selector += parts.shift() 1020 } 1021 set = posProcess(selector, set) 1022 } 1023 } 1024 } else { 1025 if (!seed && parts.length > 1 && context.nodeType === 9 && !contextXML && Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1])) { 1026 var ret = Sizzle.find(parts.shift(), context, contextXML); 1027 context = ret.expr ? Sizzle.filter(ret.expr, ret.set)[0] : ret.set[0] 1028 } 1029 if (context) { 1030 var ret = seed ? { 1031 expr: parts.pop(), 1032 set: makeArray(seed) 1033 } : Sizzle.find(parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML); 1034 set = ret.expr ? Sizzle.filter(ret.expr, ret.set) : ret.set; 1035 if (parts.length > 0) { 1036 checkSet = makeArray(set) 1037 } else { 1038 prune = false 1039 } 1040 while (parts.length) { 1041 var cur = parts.pop(), 1042 pop = cur; 1043 if (!Expr.relative[cur]) { 1044 cur = "" 1045 } else { 1046 pop = parts.pop() 1047 } 1048 if (pop == null) { 1049 pop = context 1050 } 1051 Expr.relative[cur](checkSet, pop, contextXML) 1052 } 1053 } else { 1054 checkSet = parts = [] 1055 } 1056 } 1057 if (!checkSet) { 1058 checkSet = set 1059 } 1060 if (!checkSet) { 1061 throw "Syntax error, unrecognized expression: " + (cur || selector) 1062 } 1063 if (toString.call(checkSet) === "[object Array]") { 1064 if (!prune) { 1065 results.push.apply(results, checkSet) 1066 } else { 1067 if (context && context.nodeType === 1) { 1068 for (var i = 0; checkSet[i] != null; i++) { 1069 if (checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i]))) { 1070 results.push(set[i]) 1071 } 1072 } 1073 } else { 1074 for (var i = 0; checkSet[i] != null; i++) { 1075 if (checkSet[i] && checkSet[i].nodeType === 1) { 1076 results.push(set[i]) 1077 } 1078 } 1079 } 1080 } 1081 } else { 1082 makeArray(checkSet, results) 1083 } 1084 if (extra) { 1085 Sizzle(extra, origContext, results, seed); 1086 Sizzle.uniqueSort(results) 1087 } 1088 return results 1089 }; 1090 Sizzle.uniqueSort = function(results) { 1091 if (sortOrder) { 1092 hasDuplicate = baseHasDuplicate; 1093 results.sort(sortOrder);
1094 if (hasDuplicate) { 1095 for (var i = 1; i < results.length; i++) { 1096 if (results[i] === results[i - 1]) { 1097 results.splice(i--, 1) 1098 } 1099 } 1100 } 1101 } 1102 return results 1103 }; 1104 Sizzle.matches = function(expr, set) { 1105 return Sizzle(expr, null, null, set) 1106 }; 1107 Sizzle.find = function(expr, context, isXML) { 1108 var set, match; 1109 if (!expr) { 1110 return [] 1111 } 1112 for (var i = 0, l = Expr.order.length; i < l; i++) { 1113 var type = Expr.order[i], 1114 match; 1115 if ((match = Expr.leftMatch[type].exec(expr))) { 1116 var left = match[1]; 1117 match.splice(1, 1); 1118 if (left.substr(left.length - 1) !== "\\") { 1119 match[1] = (match[1] || "").replace(/\\/g, ""); 1120 set = Expr.find[type](match, context, isXML); 1121 if (set != null) { 1122 expr = expr.replace(Expr.match[type], ""); 1123 break 1124 } 1125 } 1126 } 1127 } 1128 if (!set) { 1129 set = context.getElementsByTagName("*") 1130 } 1131 return { 1132 set: set, 1133 expr: expr 1134 } 1135 }; 1136 Sizzle.filter = function(expr, set, inplace, not) { 1137 var old = expr, 1138 result = [], 1139 curLoop = set, 1140 match, anyFound, isXMLFilter = set && set[0] && isXML(set[0]); 1141 while (expr && set.length) { 1142 for (var type in Expr.filter) { 1143 if ((match = Expr.match[type].exec(expr)) != null) { 1144 var filter = Expr.filter[type], 1145 found, item; 1146 anyFound = false; 1147 if (curLoop === result) { 1148 result = [] 1149 } 1150 if (Expr.preFilter[type]) { 1151 match = Expr.preFilter[type](match, curLoop, inplace, result, not, isXMLFilter); 1152 if (!match) { 1153 anyFound = found = true 1154 } else { 1155 if (match === true) { 1156 continue 1157 } 1158 } 1159 } 1160 if (match) { 1161 for (var i = 0; 1162 (item = curLoop[i]) != null; i++) { 1163 if (item) { 1164 found = filter(item, match, i, curLoop); 1165 var pass = not ^ !!found; 1166 if (inplace && found != null) { 1167 if (pass) { 1168 anyFound = true 1169 } else { 1170 curLoop[i] = false 1171 } 1172 } else { 1173 if (pass) { 1174 result.push(item); 1175 anyFound = true 1176 } 1177 } 1178 } 1179 } 1180 } 1181 if (found !== undefined) { 1182 if (!inplace) { 1183 curLoop = result 1184 } 1185 expr = expr.replace(Expr.match[type], ""); 1186 if (!anyFound) { 1187 return [] 1188 } 1189 break 1190 } 1191 } 1192 } 1193 if (expr === old) { 1194 if (anyFound == null) { 1195 throw "Syntax error, unrecognized expression: " + expr 1196 } else { 1197 break 1198 } 1199 } 1200 old = expr 1201 } 1202 return curLoop 1203 }; 1204 var Expr = Sizzle.selectors = { 1205 order: ["ID", "NAME", "TAG"], 1206 match: { 1207 ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, 1208 CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, 1209 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, 1210 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, 1211 TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, 1212 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, 1213 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, 1214 PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*
1214)+)\2\))?/ 1215 }, 1216 leftMatch: {}, 1217 attrMap: { 1218 "class": "className", 1219 "for": "htmlFor" 1220 }, 1221 attrHandle: { 1222 href: function(elem) { 1223 return elem.getAttribute("href") 1224 } 1225 }, 1226 relative: { 1227 "+": function(checkSet, part) { 1228 var isPartStr = typeof part === "string", 1229 isTag = isPartStr && !/\W/.test(part), 1230 isPartStrNotTag = isPartStr && !isTag; 1231 if (isTag) { 1232 part = part.toLowerCase() 1233 } 1234 for (var i = 0, l = checkSet.length, elem; i < l; i++) { 1235 if ((elem = checkSet[i])) { 1236 while ((elem = elem.previousSibling) && elem.nodeType !== 1) {} 1237 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? elem || false : elem === part 1238 } 1239 } 1240 if (isPartStrNotTag) { 1241 Sizzle.filter(part, checkSet, true) 1242 } 1243 }, 1244 ">": function(checkSet, part) { 1245 var isPartStr = typeof part === "string"; 1246 if (isPartStr && !/\W/.test(part)) { 1247 part = part.toLowerCase(); 1248 for (var i = 0, l = checkSet.length; i < l; i++) { 1249 var elem = checkSet[i]; 1250 if (elem) { 1251 var parent = elem.parentNode; 1252 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false 1253 } 1254 } 1255 } else { 1256 for (var i = 0, l = checkSet.length; i < l; i++) { 1257 var elem = checkSet[i]; 1258 if (elem) { 1259 checkSet[i] = isPartStr ? elem.parentNode : elem.parentNode === part 1260 } 1261 } 1262 if (isPartStr) { 1263 Sizzle.filter(part, checkSet, true) 1264 } 1265 } 1266 }, 1267 "": function(checkSet, part, isXML) { 1268 var doneName = done++, 1269 checkFn = dirCheck; 1270 if (typeof part === "string" && !/\W/.test(part)) { 1271 var nodeCheck = part = part.toLowerCase(); 1272 checkFn = dirNodeCheck 1273 } 1274 checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML) 1275 }, 1276 "~": function(checkSet, part, isXML) { 1277 var doneName = done++, 1278 checkFn = dirCheck; 1279 if (typeof part === "string" && !/\W/.test(part)) { 1280 var nodeCheck = part = part.toLowerCase(); 1281 checkFn = dirNodeCheck 1282 } 1283 checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML) 1284 } 1285 }, 1286 find: { 1287 ID: function(match, context, isXML) { 1288 if (typeof context.getElementById !== "undefined" && !isXML) { 1289 var m = context.getElementById(match[1]); 1290 return m ? [m] : [] 1291 } 1292 }, 1293 NAME: function(match, context) { 1294 if (typeof context.getElementsByName !== "undefined") { 1295 var ret = [], 1296 results = context.getElementsByName(match[1]); 1297 for (var i = 0, l = results.length; i < l; i++) { 1298 if (results[i].getAttribute("name") === match[1]) { 1299 ret.push(results[i]) 1300 } 1301 } 1302 return ret.length === 0 ? null : ret 1303 } 1304 }, 1305 TAG: function(match, context) { 1306 return context.getElementsByTagName(match[1]) 1307 } 1308 }, 1309 preFilter: { 1310 CLASS: function(match, curLoop, inplace, result, not, isXML) { 1311 match = " " + match[1].replace(/\\/g, "") + " "; 1312 if (isXML) { 1313 return match 1314 } 1315 for (var i = 0, elem; 1316 (elem = curLoop[i]) != null; i++) { 1317 if (elem) { 1318 if (not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0)) { 1319 if (!inplace) { 1320 result.push(elem) 1321 } 1322 } else { 1323 if (inplace) { 1324 curLoop[i] = false 1325 } 1326 } 1327 } 1328 } 1329 return false 1330 }, 1331 ID: function(match) { 1332 return match[1].replace(/\\/g, "") 1333 }, 1334 TAG: function(match, curLoop) { 1335 return match[1].toLowerCase() 1336 }, 1337 CHILD: function(match) {
1338 if (match[1] === "nth") { 1339 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test(match[2]) && "0n+" + match[2] || match[2]); 1340 match[2] = (test[1] + (test[2] || 1)) - 0; 1341 match[3] = test[3] - 0 1342 } 1343 match[0] = done++; 1344 return match 1345 }, 1346 ATTR: function(match, curLoop, inplace, result, not, isXML) { 1347 var name = match[1].replace(/\\/g, ""); 1348 if (!isXML && Expr.attrMap[name]) { 1349 match[1] = Expr.attrMap[name] 1350 } 1351 if (match[2] === "~=") { 1352 match[4] = " " + match[4] + " " 1353 } 1354 return match 1355 }, 1356 PSEUDO: function(match, curLoop, inplace, result, not) { 1357 if (match[1] === "not") { 1358 if ((chunker.exec(match[3]) || "").length > 1 || /^\w/.test(match[3])) { 1359 match[3] = Sizzle(match[3], null, null, curLoop) 1360 } else { 1361 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 1362 if (!inplace) { 1363 result.push.apply(result, ret) 1364 } 1365 return false 1366 } 1367 } else { 1368 if (Expr.match.POS.test(match[0]) || Expr.match.CHILD.test(match[0])) { 1369 return true 1370 } 1371 } 1372 return match 1373 }, 1374 POS: function(match) { 1375 match.unshift(true); 1376 return match 1377 } 1378 }, 1379 filters: { 1380 enabled: function(elem) { 1381 return elem.disabled === false && elem.type !== "hidden" 1382 }, 1383 disabled: function(elem) { 1384 return elem.disabled === true 1385 }, 1386 checked: function(elem) { 1387 return elem.checked === true 1388 }, 1389 selected: function(elem) { 1390 elem.parentNode.selectedIndex; 1391 return elem.selected === true 1392 }, 1393 parent: function(elem) { 1394 return !!elem.firstChild 1395 }, 1396 empty: function(elem) { 1397 return !elem.firstChild 1398 }, 1399 has: function(elem, i, match) { 1400 return !!Sizzle(match[3], elem).length 1401 }, 1402 header: function(elem) { 1403 return /h\d/i.test(elem.nodeName) 1404 }, 1405 text: function(elem) { 1406 return "text" === elem.type 1407 }, 1408 radio: function(elem) { 1409 return "radio" === elem.type 1410 }, 1411 checkbox: function(elem) { 1412 return "checkbox" === elem.type 1413 }, 1414 file: function(elem) { 1415 return "file" === elem.type 1416 }, 1417 password: function(elem) { 1418 return "password" === elem.type 1419 }, 1420 submit: function(elem) { 1421 return "submit" === elem.type 1422 }, 1423 image: function(elem) { 1424 return "image" === elem.type 1425 }, 1426 reset: function(elem) { 1427 return "reset" === elem.type 1428 }, 1429 button: function(elem) { 1430 return "button" === elem.type || elem.nodeName.toLowerCase() === "button" 1431 }, 1432 input: function(elem) { 1433 return /input|select|textarea|button/i.test(elem.nodeName) 1434 } 1435 }, 1436 setFilters: { 1437 first: function(elem, i) { 1438 return i === 0 1439 }, 1440 last: function(elem, i, match, array) { 1441 return i === array.length - 1 1442 }, 1443 even: function(elem, i) { 1444 return i % 2 === 0 1445 }, 1446 odd: function(elem, i) { 1447 return i % 2 === 1 1448 }, 1449 lt: function(elem, i, match) { 1450 return i < match[3] - 0 1451 }, 1452 gt: function(elem, i, match) { 1453 return i > match[3] - 0 1454 }, 1455 nth: function(elem, i, match) { 1456 return match[3] - 0 === i 1457 }, 1458 eq: function(elem, i, match) { 1459 return match[3] - 0 === i 1460 } 1461 }, 1462 filter: { 1463 PSEUDO: function(elem, match, i, array) { 1464 var name = match[1], 1465 filter = Expr.filters[name]; 1466 if (filter) { 1467 return filter(elem, i, match, array) 1468 } else { 1469 if (name === "contains") { 1470 return (elem.textContent || elem.innerText || getText([elem]) || "").indexOf(match[3]) >= 0 1471 } else { 1472 if (name === "not") { 1473 var not = match[3]; 1474 for (var i = 0, l = not.length; i < l; i++) { 1475 if (not[i] === elem) { 1476 return false 1477 } 1478 } 1479 return true 1480 } else { 1481 throw "Syntax error, unrecognized expression: " + name 1482 } 1483 } 1484 } 1485 }, 1486 CHILD: function(elem, match) { 1487 var type = match[1], 1488 node = elem; 1489 switch (type) { 1490 case "only": 1491 case "first": 1492 while ((node = node.previousSibling)) { 1493 if (node.nodeType === 1) { 1494 return false 1495 } 1496 } 1497 if (type === "first") { 1498 return true 1499 } 1500 node = elem; 1501 case "last": 1502 while ((node = node.nextSibling)) { 1503 if (node.nodeType === 1) { 1504 return false 1505 } 1506 } 1507 return true; 1508 case "nth": 1509 var first = match[2], 1510 last = match[3]; 1511 if (first === 1 && last === 0) { 1512 return true 1513 } 1514 var doneName = match[0], 1515 parent = elem.parentNode; 1516 if (parent && (parent.sizcache !== doneName || !elem.nodeIndex)) { 1517 var count = 0; 1518 for (node = parent.firstChild; node; node = node.nextSibling) { 1519 if (node.nodeType === 1) { 1520 node.nodeIndex = ++count 1521 } 1522 } 1523 parent.sizcache = doneName 1524 } 1525 var diff = elem.nodeIndex - last; 1526 if (first === 0) { 1527 return diff === 0 1528 } else { 1529 return (diff % first === 0 && diff / first >= 0) 1530 } 1531 } 1532 }, 1533 ID: function(elem, match) { 1534 return elem.nodeType === 1 && elem.getAttribute("id") === match 1535 }, 1536 TAG: function(elem, match) { 1537 return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match 1538 }, 1539 CLASS: function(elem, match) { 1540 return (" " + (elem.className || elem.getAttribute("class")) + " ").indexOf(match) > -1 1541 }, 1542 ATTR: function(elem, match) { 1543 var name = match[1], 1544 result = Expr.attrHandle[name] ? Expr.attrHandle[name](elem) : elem[name] != null ? elem[name] : elem.getAttribute(name), 1545 value = result + "", 1546 type = match[2], 1547 check = match[4]; 1548 return result == null ? type === "!=" : type === "=" ? value === check : type === "*=" ? value.indexOf(check) >= 0 : type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? value && result !== false : type === "!=" ? value !== check : type === "^=" ? value.indexOf(check) === 0 : type === "$=" ? value.substr(value.length - check.length) === check : type === "|=" ? value === check || value.substr(0, check.length + 1) === check + "-" : false 1549 }, 1550 POS: function(elem, match, i, array) { 1551 var name = match[2], 1552 filter = Expr.setFilters[name]; 1553 if (filter) { 1554 return filter(elem, i, match, array) 1555 } 1556 } 1557 } 1558 }; 1559 var origPOS = Expr.match.POS; 1560 for (var type in Expr.match) { 1561 Expr.match[type] = new RegExp(Expr.match[type].source + /(?![^\[]*\])(?![^\(]*\))/.source); 1562 Expr.leftMatch[type] = new RegExp(/(^(?:.|\r|\n)*?)/.source + Expr.match[type].source) 1563 } 1564 var makeArray = function(array, results) { 1565 array = Array.prototype.slice.call(array, 0); 1566 if (results) { 1567 results.push.apply(results, array); 1568 return results 1569 } 1570 return array 1571 }; 1572 try { 1573 Array.prototype.slice.call(document.documentElement.childNodes, 0) 1574 } catch (e) { 1575 makeArray = function(array, results) { 1576 var ret = results || []; 1577 if (toString.call(array) === "[object Array]") { 1578 Array.prototype.push.apply(ret, array) 1579 } else { 1580 if (typeof array.length === "number") { 1581 for (var i = 0, l = array.length; i < l; i++) {
1582 ret.push(array[i]) 1583 } 1584 } else { 1585 for (var i = 0; array[i]; i++) { 1586 ret.push(array[i]) 1587 } 1588 } 1589 } 1590 return ret 1591 } 1592 } 1593 var sortOrder; 1594 if (document.documentElement.compareDocumentPosition) { 1595 sortOrder = function(a, b) { 1596 if (!a.compareDocumentPosition || !b.compareDocumentPosition) { 1597 if (a == b) { 1598 hasDuplicate = true 1599 } 1600 return a.compareDocumentPosition ? -1 : 1 1601 } 1602 var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; 1603 if (ret === 0) { 1604 hasDuplicate = true 1605 } 1606 return ret 1607 } 1608 } else { 1609 if ("sourceIndex" in document.documentElement) { 1610 sortOrder = function(a, b) { 1611 if (!a.sourceIndex || !b.sourceIndex) { 1612 if (a == b) { 1613 hasDuplicate = true 1614 } 1615 return a.sourceIndex ? -1 : 1 1616 } 1617 var ret = a.sourceIndex - b.sourceIndex; 1618 if (ret === 0) { 1619 hasDuplicate = true 1620 } 1621 return ret 1622 } 1623 } else { 1624 if (document.createRange) { 1625 sortOrder = function(a, b) { 1626 if (!a.ownerDocument || !b.ownerDocument) { 1627 if (a == b) { 1628 hasDuplicate = true 1629 } 1630 return a.ownerDocument ? -1 : 1 1631 } 1632 var aRange = a.ownerDocument.createRange(), 1633 bRange = b.ownerDocument.createRange(); 1634 aRange.setStart(a, 0); 1635 aRange.setEnd(a, 0); 1636 bRange.setStart(b, 0); 1637 bRange.setEnd(b, 0); 1638 var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); 1639 if (ret === 0) { 1640 hasDuplicate = true 1641 } 1642 return ret 1643 } 1644 } 1645 } 1646 } 1647 1648 function getText(elems) { 1649 var ret = "", 1650 elem; 1651 for (var i = 0; elems[i]; i++) { 1652 elem = elems[i]; 1653 if (elem.nodeType === 3 || elem.nodeType === 4) { 1654 ret += elem.nodeValue 1655 } else { 1656 if (elem.nodeType !== 8) { 1657 ret += getText(elem.childNodes) 1658 } 1659 } 1660 } 1661 return ret 1662 }(function() { 1663 var form = document.createElement("div"), 1664 id = "script" + (new Date).getTime(); 1665 form.innerHTML = "<a name='" + id + "'/>"; 1666 var root = document.documentElement; 1667 root.insertBefore(form, root.firstChild); 1668 if (document.getElementById(id)) { 1669 Expr.find.ID = function(match, context, isXML) { 1670 if (typeof context.getElementById !== "undefined" && !isXML) { 1671 var m = context.getElementById(match[1]); 1672 return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [] 1673 } 1674 }; 1675 Expr.filter.ID = function(elem, match) { 1676 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 1677 return elem.nodeType === 1 && node && node.nodeValue === match 1678 } 1679 } 1680 root.removeChild(form); 1681 root = form = null 1682 })(); 1683 (function() { 1684 var div = document.createElement("div"); 1685 div.appendChild(document.createComment("")); 1686 if (div.getElementsByTagName("*").length > 0) { 1687 Expr.find.TAG = function(match, context) { 1688 var results = context.getElementsByTagName(match[1]); 1689 if (match[1] === "*") { 1690 var tmp = []; 1691 for (var i = 0; results[i]; i++) { 1692 if (results[i].nodeType === 1) { 1693 tmp.push(results[i]) 1694 } 1695 } 1696 results = tmp 1697 } 1698 return results 1699 } 1700 } 1701 div.innerHTML = "<a href='#'></a>"; 1702 if (div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && div.firstChild.getAttribute("href") !== "#") { 1703 Expr.attrHandle.href = function(elem) { 1704 return elem.getAttribute("href", 2) 1705 } 1706 } 1707 div = null 1708 })(); 1709 if (document.querySelectorAll) { 1710 (function() {
1711 var oldSizzle = Sizzle, 1712 div = document.createElement("div"); 1713 div.innerHTML = "<p class='TEST'></p>"; 1714 if (div.querySelectorAll && div.querySelectorAll(".TEST").length === 0) { 1715 return 1716 } 1717 Sizzle = function(query, context, extra, seed) { 1718 context = context || document; 1719 if (!seed && context.nodeType === 9 && !isXML(context)) { 1720 try { 1721 return makeArray(context.querySelectorAll(query), extra) 1722 } catch (e) {} 1723 } 1724 return oldSizzle(query, context, extra, seed) 1725 }; 1726 for (var prop in oldSizzle) { 1727 Sizzle[prop] = oldSizzle[prop] 1728 } 1729 div = null 1730 })() 1731 }(function() { 1732 var div = document.createElement("div"); 1733 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 1734 if (!div.getElementsByClassName || div.getElementsByClassName("e").length === 0) { 1735 return 1736 }
1737 div.lastChild.className = "e"; 1738 if (div.getElementsByClassName("e").length === 1) { 1739 return 1740 } 1741 Expr.order.splice(1, 0, "CLASS"); 1742 Expr.find.CLASS = function(match, context, isXML) { 1743 if (typeof context.getElementsByClassName !== "undefined" && !isXML) { 1744 return context.getElementsByClassName(match[1]) 1745 } 1746 }; 1747 div = null 1748 })(); 1749 1750 function dirNodeCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) { 1751 for (var i = 0, l = checkSet.length; i < l; i++) { 1752 var elem = checkSet[i]; 1753 if (elem) { 1754 elem = elem[dir]; 1755 var match = false; 1756 while (elem) { 1757 if (elem.sizcache === doneName) { 1758 match = checkSet[elem.sizset]; 1759 break 1760 } 1761 if (elem.nodeType === 1 && !isXML) { 1762 elem.sizcache = doneName; 1763 elem.sizset = i 1764 } 1765 if (elem.nodeName.toLowerCase() === cur) { 1766 match = elem; 1767 break 1768 } 1769 elem = elem[dir] 1770 } 1771 checkSet[i] = match 1772 } 1773 } 1774 } 1775 1776 function dirCheck(dir, cur, doneName, checkSet, nodeCheck, isXML) { 1777 for (var i = 0, l = checkSet.length; i < l; i++) { 1778 var elem = checkSet[i]; 1779 if (elem) { 1780 elem = elem[dir]; 1781 var match = false; 1782 while (elem) { 1783 if (elem.sizcache === doneName) { 1784 match = checkSet[elem.sizset]; 1785 break 1786 } 1787 if (elem.nodeType === 1) { 1788 if (!isXML) { 1789 elem.sizcache = doneName; 1790 elem.sizset = i 1791 } 1792 if (typeof cur !== "string") { 1793 if (elem === cur) { 1794 match = true; 1795 break 1796 } 1797 } else { 1798 if (Sizzle.filter(cur, [elem]).length > 0) { 1799 match = elem; 1800 break 1801 } 1802 } 1803 } 1804 elem = elem[dir] 1805 } 1806 checkSet[i] = match 1807 } 1808 } 1809 } 1810 var contains = document.compareDocumentPosition ? function(a, b) { 1811 return a.compareDocumentPosition(b) & 16 1812 } : function(a, b) { 1813 return a !== b && (a.contains ? a.contains(b) : true) 1814 }; 1815 var isXML = function(elem) { 1816 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; 1817 return documentElement ? documentElement.nodeName !== "HTML" : false 1818 }; 1819 var posProcess = function(selector, context) { 1820 var tmpSet = [], 1821 later = "", 1822 match, root = context.nodeType ? [context] : context; 1823 while ((match = Expr.match.PSEUDO.exec(selector))) { 1824 later += match[0]; 1825 selector = selector.replace(Expr.match.PSEUDO, "") 1826 } 1827 selector = Expr.relative[selector] ? selector + "*" : selector; 1828 for (var i = 0, l = root.length; i < l; i++) { 1829 Sizzle(selector, root[i], tmpSet) 1830 } 1831 return Sizzle.filter(later, tmpSet) 1832 }; 1833 return Sizzle 1834 })(); 1835 /* 1836 * SWFObject v2.1 <http://code.google.com/p/swfobject/> 1837 * Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis 1838 * This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 1839 * 1840 * Modified for inclusion in Shadowbox.js 1841 */ 1842 S.flash = (function() { 1843 var swfobject = function() { 1844 var UNDEF = "undefined", 1845 OBJECT = "object", 1846 SHOCKWAVE_FLASH = "Shockwave Flash", 1847 SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", 1848 FLASH_MIME_TYPE = "application/x-shockwave-flash", 1849 EXPRESS_INSTALL_ID = "SWFObjectExprInst", 1850 win = window, 1851 doc = document, 1852 nav = navigator, 1853 domLoadFnArr = [], 1854 regObjArr = [], 1855 objIdArr = [], 1856 listenersArr = [], 1857 script, timer = null, 1858 storedAltContent = null, 1859 storedAltContentId = null, 1860 isDomLoaded = false, 1861 isExpressInstallActive = false;
1862 var ua = function() { 1863 var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, 1864 playerVersion = [0, 0, 0], 1865 d = null; 1866 if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { 1867 d = nav.plugins[SHOCKWAVE_FLASH].description; 1868 if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { 1869 d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); 1870 playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); 1871 playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); 1872 playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0 1873 } 1874 } else { 1875 if (typeof win.ActiveXObject != UNDEF) { 1876 var a = null, 1877 fp6Crash = false; 1878 try { 1879 a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7") 1880 } catch (e) { 1881 try { 1882 a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6"); 1883 playerVersion = [6, 0, 21]; 1884 a.AllowScriptAccess = "always" 1885 } catch (e) { 1886 if (playerVersion[0] == 6) { 1887 fp6Crash = true 1888 } 1889 } 1890 if (!fp6Crash) { 1891 try { 1892 a = new ActiveXObject(SHOCKWAVE_FLASH_AX) 1893 } catch (e) {} 1894 } 1895 } 1896 if (!fp6Crash && a) { 1897 try { 1898 d = a.GetVariable("$version"); 1899 if (d) { 1900 d = d.split(" ")[1].split(","); 1901 playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)] 1902 } 1903 } catch (e) {} 1904 } 1905 } 1906 } 1907 var u = nav.userAgent.toLowerCase(), 1908 p = nav.platform.toLowerCase(), 1909 webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, 1910 ie = false, 1911 windows = p ? /win/.test(p) : /win/.test(u), 1912 mac = p ? /mac/.test(p) : /mac/.test(u); 1913 /*@cc_on 1914 ie = true; 1915 @if (@_win32) 1916 windows = true; 1917 @elif (@_mac) 1918 mac = true; 1919 @end 1920 @*/ 1921 return { 1922 w3cdom: w3cdom, 1923 pv: playerVersion, 1924 webkit: webkit, 1925 ie: ie, 1926 win: windows, 1927 mac: mac 1928 } 1929 }(); 1930 var onDomLoad = function() { 1931 if (!ua.w3cdom) { 1932 return 1933 } 1934 addDomLoadEvent(main); 1935 if (ua.ie && ua.win) { 1936 try { 1937 doc.write("<script id=__ie_ondomload defer=true src=//:><\/script>"); 1938 script = getElementById("__ie_ondomload"); 1939 if (script) { 1940 addListener(script, "onreadystatechange", checkReadyState) 1941 } 1942 } catch (e) {} 1943 } 1944 if (ua.webkit && typeof doc.readyState != UNDEF) { 1945 timer = setInterval(function() { 1946 if (/loaded|complete/.test(doc.readyState)) { 1947 callDomLoadFunctions() 1948 } 1949 }, 10) 1950 } 1951 if (typeof doc.addEventListener != UNDEF) { 1952 doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null) 1953 } 1954 addLoadEvent(callDomLoadFunctions) 1955 }(); 1956 1957 function checkReadyState() { 1958 if (script.readyState == "complete") { 1959 script.parentNode.removeChild(script); 1960 callDomLoadFunctions() 1961 } 1962 } 1963 1964 function callDomLoadFunctions() { 1965 if (isDomLoaded) { 1966 return 1967 } 1968 if (ua.ie && ua.win) { 1969 var s = createElement("span"); 1970 try { 1971 var t = doc.getElementsByTagName("body")[0].appendChild(s); 1972 t.parentNode.removeChild(t) 1973 } catch (e) { 1974 return 1975 } 1976 } 1977 isDomLoaded = true; 1978 if (timer) { 1979 clearInterval(timer); 1980 timer = null 1981 } 1982 var dl = domLoadFnArr.length; 1983 for (var i = 0; i < dl; i++) { 1984 domLoadFnArr[i]() 1985 } 1986 } 1987 1988 function addDomLoadEvent(fn) { 1989 if (isDomLoaded) { 1990 fn() 1991 } else { 1992 domLoadFnArr[domLoadFnArr.length] = fn 1993 } 1994 } 1995 1996 function addLoadEvent(fn) { 1997 if (typeof win.addEventListener != UNDEF) { 1998 win.addEventListener("load", fn, false) 1999 } else { 2000 if (typeof doc.addEventListener != UNDEF) { 2001 doc.addEventListener("load", fn, false) 2002 } else { 2003 if (typeof win.attachEvent != UNDEF) { 2004 addListener(win, "onload", fn) 2005 } else { 2006 if (typeof win.onload == "function") { 2007 var fnOld = win.onload; 2008 win.onload = function() { 2009 fnOld(); 2010 fn() 2011 } 2012 } else { 2013 win.onload = fn 2014 } 2015 } 2016 } 2017 } 2018 } 2019 2020 function main() { 2021 var rl = regObjArr.length; 2022 for (var i = 0; i < rl; i++) { 2023 var id = regObjArr[i].id; 2024 if (ua.pv[0] > 0) { 2025 var obj = getElementById(id); 2026 if (obj) { 2027 regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0"; 2028 regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0"; 2029 if (hasPlayerVersion(regObjArr[i].swfVersion)) { 2030 if (ua.webkit && ua.webkit < 312) { 2031 fixParams(obj) 2032 } 2033 setVisibility(id, true) 2034 } else { 2035 if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { 2036 showExpressInstall(regObjArr[i]) 2037 } else { 2038 displayAltContent(obj) 2039 } 2040 } 2041 } 2042 } else { 2043 setVisibility(id, true) 2044 } 2045 } 2046 } 2047 2048 function fixParams(obj) { 2049 var nestedObj = obj.getElementsByTagName(OBJECT)[0];
2050 if (nestedObj) { 2051 var e = createElement("embed"), 2052 a = nestedObj.attributes; 2053 if (a) { 2054 var al = a.length; 2055 for (var i = 0; i < al; i++) { 2056 if (a[i].nodeName == "DATA") { 2057 e.setAttribute("src", a[i].nodeValue) 2058 } else { 2059 e.setAttribute(a[i].nodeName, a[i].nodeValue) 2060 } 2061 } 2062 } 2063 var c = nestedObj.childNodes; 2064 if (c) { 2065 var cl = c.length; 2066 for (var j = 0; j < cl; j++) { 2067 if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") { 2068 e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value")) 2069 } 2070 } 2071 } 2072 obj.parentNode.replaceChild(e, obj) 2073 } 2074 } 2075 2076 function showExpressInstall(regObj) { 2077 isExpressInstallActive = true; 2078 var obj = getElementById(regObj.id); 2079 if (obj) { 2080 if (regObj.altContentId) { 2081 var ac = getElementById(regObj.altContentId); 2082 if (ac) { 2083 storedAltContent = ac; 2084 storedAltContentId = regObj.altContentId 2085 } 2086 } else { 2087 storedAltContent = abstractAltContent(obj) 2088 } 2089 if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) { 2090 regObj.width = "310" 2091 } 2092 if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) { 2093 regObj.height = "137" 2094 } 2095 doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; 2096 var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", 2097 dt = doc.title, 2098 fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt, 2099 replaceId = regObj.id; 2100 if (ua.ie && ua.win && obj.readyState != 4) { 2101 var newObj = createElement("div"); 2102 replaceId += "SWFObjectNew"; 2103 newObj.setAttribute("id", replaceId); 2104 obj.parentNode.insertBefore(newObj, obj); 2105 obj.style.display = "none"; 2106 var fn = function() { 2107 obj.parentNode.removeChild(obj) 2108 }; 2109 addListener(win, "onload", fn) 2110 } 2111 createSWF({ 2112 data: regObj.expressInstall, 2113 id: EXPRESS_INSTALL_ID, 2114 width: regObj.width, 2115 height: regObj.height 2116 }, { 2117 flashvars: fv 2118 }, replaceId) 2119 } 2120 } 2121 2122 function displayAltContent(obj) { 2123 if (ua.ie && ua.win && obj.readyState != 4) { 2124 var el = createElement("div"); 2125 obj.parentNode.insertBefore(el, obj); 2126 el.parentNode.replaceChild(abstractAltContent(obj), el); 2127 obj.style.display = "none"; 2128 var fn = function() { 2129 obj.parentNode.removeChild(obj) 2130 }; 2131 addListener(win, "onload", fn) 2132 } else { 2133 obj.parentNode.replaceChild(abstractAltContent(obj), obj) 2134 } 2135 } 2136 2137 function abstractAltContent(obj) { 2138 var ac = createElement("div"); 2139 if (ua.win && ua.ie) { 2140 ac.innerHTML = obj.innerHTML 2141 } else { 2142 var nestedObj = obj.getElementsByTagName(OBJECT)[0];
2143 if (nestedObj) { 2144 var c = nestedObj.childNodes; 2145 if (c) { 2146 var cl = c.length; 2147 for (var i = 0; i < cl; i++) { 2148 if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { 2149 ac.appendChild(c[i].cloneNode(true)) 2150 } 2151 } 2152 } 2153 } 2154 } 2155 return ac 2156 } 2157 2158 function createSWF(attObj, parObj, id) { 2159 var r, el = getElementById(id); 2160 if (el) { 2161 if (typeof attObj.id == UNDEF) { 2162 attObj.id = id 2163 } 2164 if (ua.ie && ua.win) { 2165 var att = ""; 2166 for (var i in attObj) { 2167 if (attObj[i] != Object.prototype[i]) { 2168 if (i.toLowerCase() == "data") { 2169 parObj.movie = attObj[i] 2170 } else { 2171 if (i.toLowerCase() == "styleclass") { 2172 att += ' class="' + attObj[i] + '"' 2173 } else { 2174 if (i.toLowerCase() != "classid") { 2175 att += " " + i + '="' + attObj[i] + '"' 2176 } 2177 } 2178 } 2179 } 2180 } 2181 var par = ""; 2182 for (var j in parObj) { 2183 if (parObj[j] != Object.prototype[j]) { 2184 par += '<param name="' + j + '" value="' + parObj[j] + '" />' 2185 } 2186 } 2187 el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + ">" + par + "</object>"; 2188 objIdArr[objIdArr.length] = attObj.id; 2189 r = getElementById(attObj.id) 2190 } else { 2191 if (ua.webkit && ua.webkit < 312) { 2192 var e = createElement("embed"); 2193 e.setAttribute("type", FLASH_MIME_TYPE); 2194 for (var k in attObj) { 2195 if (attObj[k] != Object.prototype[k]) { 2196 if (k.toLowerCase() == "data") { 2197 e.setAttribute("src", attObj[k]) 2198 } else { 2199 if (k.toLowerCase() == "styleclass") { 2200 e.setAttribute("class", attObj[k]) 2201 } else { 2202 if (k.toLowerCase() != "classid") { 2203 e.setAttribute(k, attObj[k]) 2204 } 2205 } 2206 } 2207 } 2208 } 2209 for (var l in parObj) { 2210 if (parObj[l] != Object.prototype[l]) { 2211 if (l.toLowerCase() != "movie") { 2212 e.setAttribute(l, parObj[l]) 2213 } 2214 } 2215 } 2216 el.parentNode.replaceChild(e, el); 2217 r = e 2218 } else { 2219 var o = createElement(OBJECT); 2220 o.setAttribute("type", FLASH_MIME_TYPE); 2221 for (var m in attObj) { 2222 if (attObj[m] != Object.prototype[m]) { 2223 if (m.toLowerCase() == "styleclass") { 2224 o.setAttribute("class", attObj[m]) 2225 } else { 2226 if (m.toLowerCase() != "classid") { 2227 o.setAttribute(m, attObj[m]) 2228 } 2229 } 2230 } 2231 } 2232 for (var n in parObj) { 2233 if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { 2234 createObjParam(o, n, parObj[n]) 2235 } 2236 } 2237 el.parentNode.replaceChild(o, el); 2238 r = o 2239 } 2240 } 2241 } 2242 return r 2243 } 2244 2245 function createObjParam(el, pName, pValue) { 2246 var p = createElement("param"); 2247 p.setAttribute("name", pName); 2248 p.setAttribute("value", pValue); 2249 el.appendChild(p) 2250 } 2251 2252 function removeSWF(id) { 2253 var obj = getElementById(id); 2254 if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) { 2255 if (ua.ie && ua.win) { 2256 if (obj.readyState == 4) { 2257 removeObjectInIE(id) 2258 } else { 2259 win.attachEvent("onload", function() { 2260 removeObjectInIE(id) 2261 }) 2262 } 2263 } else { 2264 obj.parentNode.removeChild(obj) 2265 } 2266 } 2267 } 2268 2269 function removeObjectInIE(id) { 2270 var obj = getElementById(id); 2271 if (obj) { 2272 for (var i in obj) { 2273 if (typeof obj[i] == "function") { 2274 obj[i] = null 2275 } 2276 } 2277 obj.parentNode.removeChild(obj) 2278 } 2279 } 2280 2281 function getElementById(id) { 2282 var el = null; 2283 try { 2284 el = doc.getElementById(id) 2285 } catch (e) {} 2286 return el 2287 } 2288 2289 function createElement(el) { 2290 return doc.createElement(el) 2291 } 2292
2293 function addListener(target, eventType, fn) { 2294 target.attachEvent(eventType, fn); 2295 listenersArr[listenersArr.length] = [target, eventType, fn] 2296 } 2297 2298 function hasPlayerVersion(rv) { 2299 var pv = ua.pv, 2300 v = rv.split("."); 2301 v[0] = parseInt(v[0], 10); 2302 v[1] = parseInt(v[1], 10) || 0; 2303 v[2] = parseInt(v[2], 10) || 0; 2304 return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false 2305 } 2306 2307 function createCSS(sel, decl) { 2308 if (ua.ie && ua.mac) { 2309 return 2310 } 2311 var h = doc.getElementsByTagName("head")[0], 2312 s = createElement("style"); 2313 s.setAttribute("type", "text/css"); 2314 s.setAttribute("media", "screen"); 2315 if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) { 2316 s.appendChild(doc.createTextNode(sel + " {" + decl + "}")) 2317 } 2318 h.appendChild(s); 2319 if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { 2320 var ls = doc.styleSheets[doc.styleSheets.length - 1]; 2321 if (typeof ls.addRule == OBJECT) { 2322 ls.addRule(sel, decl) 2323 } 2324 } 2325 } 2326 2327 function setVisibility(id, isVisible) { 2328 var v = isVisible ? "visible" : "hidden"; 2329 if (isDomLoaded && getElementById(id)) { 2330 getElementById(id).style.visibility = v 2331 } else { 2332 createCSS("#" + id, "visibility:" + v) 2333 } 2334 } 2335 2336 function urlEncodeIfNecessary(s) { 2337 var regex = /[\\\"<>\.;]/; 2338 var hasBadChars = regex.exec(s) != null; 2339 return hasBadChars ? encodeURIComponent(s) : s 2340 } 2341 var cleanup = function() { 2342 if (ua.ie && ua.win) { 2343 window.attachEvent("onunload", function() { 2344 var ll = listenersArr.length; 2345 for (var i = 0; i < ll; i++) { 2346 listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]) 2347 } 2348 var il = objIdArr.length; 2349 for (var j = 0; j < il; j++) { 2350 removeSWF(objIdArr[j]) 2351 } 2352 for (var k in ua) { 2353 ua[k] = null 2354 } 2355 ua = null; 2356 for (var l in swfobject) { 2357 swfobject[l] = null 2358 } 2359 swfobject = null 2360 }) 2361 } 2362 }(); 2363 return { 2364 registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) { 2365 if (!ua.w3cdom || !objectIdStr || !swfVersionStr) { 2366 return 2367 } 2368 var regObj = {}; 2369 regObj.id = objectIdStr; 2370 regObj.swfVersion = swfVersionStr; 2371 regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false; 2372 regObjArr[regObjArr.length] = regObj; 2373 setVisibility(objectIdStr, false) 2374 }, 2375 getObjectById: function(objectIdStr) { 2376 var r = null; 2377 if (ua.w3cdom) { 2378 var o = getElementById(objectIdStr); 2379 if (o) { 2380 var n = o.getElementsByTagName(OBJECT)[0]; 2381 if (!n || (n && typeof o.SetVariable != UNDEF)) { 2382 r = o 2383 } else { 2384 if (typeof n.SetVariable != UNDEF) { 2385 r = n 2386 } 2387 } 2388 } 2389 } 2390 return r 2391 }, 2392 embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) { 2393 if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) { 2394 return 2395 } 2396 widthStr += ""; 2397 heightStr += ""; 2398 if (hasPlayerVersion(swfVersionStr)) { 2399 setVisibility(replaceElemIdStr, false); 2400 var att = {}; 2401 if (attObj && typeof attObj === OBJECT) { 2402 for (var i in attObj) { 2403 if (attObj[i] != Object.prototype[i]) { 2404 att[i] = attObj[i] 2405 } 2406 } 2407 } 2408 att.data = swfUrlStr; 2409 att.width = widthStr; 2410 att.height = heightStr; 2411 var par = {}; 2412 if (parObj && typeof parObj === OBJECT) { 2413 for (var j in parObj) { 2414 if (parObj[j] != Object.prototype[j]) { 2415 par[j] = parObj[j] 2416 } 2417 } 2418 } 2419 if (flashvarsObj && typeof flashvarsObj === OBJECT) { 2420 for (var k in flashvarsObj) { 2421 if (flashvarsObj[k] != Object.prototype[k]) { 2422 if (typeof par.flashvars != UNDEF) { 2423 par.flashvars += "&" + k + "=" + flashvarsObj[k] 2424 } else { 2425 par.flashvars = k + "=" + flashvarsObj[k] 2426 } 2427 } 2428 } 2429 } 2430 addDomLoadEvent(function() { 2431 createSWF(att, par, replaceElemIdStr); 2432 if (att.id == replaceElemIdStr) { 2433 setVisibility(replaceElemIdStr, true) 2434 } 2435 }) 2436 } else { 2437 if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { 2438 isExpressInstallActive = true; 2439 setVisibility(replaceElemIdStr, false); 2440 addDomLoadEvent(function() { 2441 var regObj = {}; 2442 regObj.id = regObj.altContentId = replaceElemIdStr; 2443 regObj.width = widthStr; 2444 regObj.height = heightStr; 2445 regObj.expressInstall = xiSwfUrlStr; 2446 showExpressInstall(regObj) 2447 }) 2448 } 2449 } 2450 }, 2451 getFlashPlayerVersion: function() { 2452 return { 2453 major: ua.pv[0], 2454 minor: ua.pv[1], 2455 release: ua.pv[2] 2456 } 2457 }, 2458 hasFlashPlayerVersion: hasPlayerVersion, 2459 createSWF: function(attObj, parObj, replaceElemIdStr) { 2460 if (ua.w3cdom) { 2461 return createSWF(attObj, parObj, replaceElemIdStr) 2462 } else { 2463 return undefined 2464 } 2465 }, 2466 removeSWF: function(objElemIdStr) { 2467 if (ua.w3cdom) { 2468 removeSWF(objElemIdStr) 2469 } 2470 }, 2471 createCSS: function(sel, decl) { 2472 if (ua.w3cdom) { 2473 createCSS(sel, decl) 2474 } 2475 }, 2476 addDomLoadEvent: addDomLoadEvent, 2477 addLoadEvent: addLoadEvent, 2478 getQueryParamValue: function(param) { 2479 var q = doc.location.search || doc.location.hash; 2480 if (param == null) { 2481 return urlEncodeIfNecessary(q) 2482 } 2483 if (q) { 2484 var pairs = q.substring(1).split("&"); 2485 for (var i = 0; i < pairs.length; i++) { 2486 if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { 2487 return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))) 2488 } 2489 } 2490 } 2491 return "" 2492 }, 2493 expressInstallCallback: function() { 2494 if (isExpressInstallActive && storedAltContent) { 2495 var obj = getElementById(EXPRESS_INSTALL_ID); 2496 if (obj) { 2497 obj.parentNode.replaceChild(storedAltContent, obj); 2498 if (storedAltContentId) { 2499 setVisibility(storedAltContentId, true); 2500 if (ua.ie && ua.win) { 2501 storedAltContent.style.display = "block" 2502 } 2503 } 2504 storedAltContent = null; 2505 storedAltContentId = null; 2506 isExpressInstallActive = false 2507 } 2508 } 2509 } 2510 } 2511 }(); 2512 return swfobject 2513 })(); 2514 S.lang = { 2515 code: "en", 2516 of: "of", 2517 loading: "loading", 2518 cancel: "Cancel", 2519 next: "Next", 2520 previous: "Previous", 2521 play: "Play", 2522 pause: "Pause", 2523 close: "Close", 2524 errors: { 2525 single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.', 2526 shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.', 2527 either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.' 2528 } 2529 }; 2530 var pre, proxyId = "sb-drag-proxy", 2531 dragData, dragProxy, dragTarget; 2532 2533 function resetDrag() { 2534 dragData = { 2535 x: 0, 2536 y: 0, 2537 startX: null, 2538 startY: null 2539 } 2540 } 2541 2542 function updateProxy() { 2543 var dims = S.dimensions; 2544 apply(dragProxy.style, { 2545 height: dims.innerHeight + "px", 2546 width: dims.innerWidth + "px" 2547 }) 2548 } 2549 2550 function enableDrag() { 2551 resetDrag(); 2552 var style = ["position:absolute", "cursor:" + (S.isGecko ? "-moz-grab" : "move"), "background-color:" + (S.isIE ? "#fff;filter:alpha(opacity=0)" : "transparent")].join(";"); 2553 S.appendHTML(S.skin.body, '<div id="' + proxyId + '" style="' + style + '"></div>'); 2554 dragProxy = get(proxyId); 2555 updateProxy(); 2556 addEvent(dragProxy, "mousedown", startDrag) 2557 } 2558 2559 function disableDrag() { 2560 if (dragProxy) { 2561 removeEvent(dragProxy, "mousedown", startDrag); 2562 remove(dragProxy); 2563 dragProxy = null 2564 } 2565 dragTarget = null 2566 } 2567 2568 function startDrag(e) { 2569 preventDefault(e); 2570 var xy = getPageXY(e); 2571 dragData.startX = xy[0]; 2572 dragData.startY = xy[1]; 2573 dragTarget = get(S.player.id); 2574 addEvent(document, "mousemove", positionDrag); 2575 addEvent(document, "mouseup", endDrag); 2576 if (S.isGecko) { 2577 dragProxy.style.cursor = "-moz-grabbing" 2578 } 2579 } 2580 2581 function positionDrag(e) { 2582 var player = S.player, 2583 dims = S.dimensions, 2584 xy = getPageXY(e); 2585 var moveX = xy[0] - dragData.startX; 2586 dragData.startX += moveX; 2587 dragData.x = Math.max(Math.min(0, dragData.x + moveX), dims.innerWidth - player.width); 2588 var moveY = xy[1] - dragData.startY; 2589 dragData.startY += moveY; 2590 dragData.y = Math.max(Math.min(0, dragData.y + moveY), dims.innerHeight - player.height); 2591 apply(dragTarget.style, { 2592 left: dragData.x + "px", 2593 top: dragData.y + "px" 2594 }) 2595 } 2596
2597 function endDrag() { 2598 removeEvent(document, "mousemove", positionDrag); 2599 removeEvent(document, "mouseup", endDrag); 2600 if (S.isGecko) { 2601 dragProxy.style.cursor = "-moz-grab" 2602 } 2603 } 2604 S.img = function(obj, id) { 2605 this.obj = obj; 2606 this.id = id; 2607 this.ready = false; 2608 var self = this; 2609 pre = new Image(); 2610 pre.onload = function() { 2611 self.height = obj.height ? parseInt(obj.height, 10) : pre.height; 2612 self.width = obj.width ? parseInt(obj.width, 10) : pre.width; 2613 self.ready = true; 2614 pre.onload = null; 2615 pre = null 2616 }; 2617 pre.src = obj.content 2618 }; 2619 S.img.ext = ["bmp", "gif", "jpg", "jpeg", "png"]; 2620 S.img.prototype = { 2621 append: function(body, dims) { 2622 var img = document.createElement("img"); 2623 img.id = this.id; 2624 img.src = this.obj.content; 2625 img.style.position = "absolute"; 2626 var height, width; 2627 if (dims.oversized && S.options.handleOversize == "resize") { 2628 height = dims.innerHeight; 2629 width = dims.innerWidth 2630 } else { 2631 height = this.height; 2632 width = this.width 2633 } 2634 img.setAttribute("height", height); 2635 img.setAttribute("width", width); 2636 body.appendChild(img) 2637 }, 2638 remove: function() { 2639 var el = get(this.id); 2640 if (el) { 2641 remove(el) 2642 } 2643 disableDrag(); 2644 if (pre) { 2645 pre.onload = null; 2646 pre = null 2647 } 2648 }, 2649 onLoad: function() { 2650 var dims = S.dimensions; 2651 if (dims.oversized && S.options.handleOversize == "drag") { 2652 enableDrag() 2653 } 2654 }, 2655 onWindowResize: function() { 2656 var dims = S.dimensions; 2657 switch (S.options.handleOversize) { 2658 case "resize": 2659 var el = get(this.id); 2660 el.height = dims.innerHeight; 2661 el.width = dims.innerWidth; 2662 break; 2663 case "drag": 2664 if (dragTarget) { 2665 var top = parseInt(S.getStyle(dragTarget, "top")), 2666 left = parseInt(S.getStyle(dragTarget, "left")); 2667 if (top + this.height < dims.innerHeight) { 2668 dragTarget.style.top = dims.innerHeight - this.height + "px" 2669 } 2670 if (left + this.width < dims.innerWidth) { 2671 dragTarget.style.left = dims.innerWidth - this.width + "px" 2672 } 2673 updateProxy() 2674 } 2675 break 2676 } 2677 } 2678 }; 2679 S.iframe = function(obj, id) { 2680 this.obj = obj; 2681 this.id = id; 2682 var overlay = get("sb-overlay"); 2683 this.height = obj.height ? parseInt(obj.height, 10) : overlay.offsetHeight; 2684 this.width = obj.width ? parseInt(obj.width, 10) : overlay.offsetWidth 2685 }; 2686 S.iframe.prototype = { 2687 append: function(body, dims) { 2688 var html = '<iframe allowfullscreen="true" id="' + this.id + '" name="' + this.id + '" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" style="visibility:hidden" onload="this.style.visibility=\'visible\'" scrolling="auto"'; 2689 if (S.isIE) { 2690 html += ' allowtransparency="true"'; 2691 if (S.isIE6) { 2692 html += " src=\"javascript:false;document.write('');\"" 2693 } 2694 } 2695 html += "></iframe>"; 2696 body.innerHTML = html 2697 }, 2698 remove: function() { 2699 var el = get(this.id); 2700 if (el) { 2701 remove(el); 2702 if (S.isGecko) { 2703 delete window.frames[this.id] 2704 } 2705 } 2706 }, 2707 onLoad: function() {
2708 var win = S.isIE ? get(this.id).contentWindow : window.frames[this.id]; 2709 win.location.href = this.obj.content 2710 } 2711 }; 2712 S.html = function(obj, id) { 2713 this.obj = obj; 2714 this.id = id; 2715 this.height = obj.height ? parseInt(obj.height, 10) : 300; 2716 this.width = obj.width ? parseInt(obj.width, 10) : 500 2717 }; 2718 S.html.prototype = { 2719 append: function(body, dims) { 2720 var div = document.createElement("div"); 2721 div.id = this.id; 2722 div.className = "html"; 2723 div.innerHTML = this.obj.content; 2724 body.appendChild(div) 2725 }, 2726 remove: function() { 2727 var el = get(this.id); 2728 if (el) { 2729 remove(el) 2730 } 2731 } 2732 }; 2733 S.swf = function(obj, id) { 2734 this.obj = obj; 2735 this.id = id; 2736 this.height = obj.height ? parseInt(obj.height, 10) : 300; 2737 this.width = obj.width ? parseInt(obj.width, 10) : 300 2738 }; 2739 S.swf.ext = ["swf"]; 2740 S.swf.prototype = { 2741 append: function(body, dims) { 2742 var tmp = document.createElement("div"); 2743 tmp.id = this.id; 2744 body.appendChild(tmp); 2745 var height = dims.innerHeight, 2746 width = dims.innerWidth, 2747 swf = this.obj.content, 2748 version = S.options.flashVersion, 2749 express = S.path + "expressInstall.swf", 2750 flashvars = S.options.flashVars, 2751 params = S.options.flashParams; 2752 S.flash.embedSWF(swf, this.id, width, height, version, express, flashvars, params) 2753 }, 2754 remove: function() { 2755 S.flash.expressInstallCallback(); 2756 S.flash.removeSWF(this.id) 2757 }, 2758 onWindowResize: function() { 2759 var dims = S.dimensions, 2760 el = get(this.id); 2761 el.height = dims.innerHeight; 2762 el.width = dims.innerWidth 2763 } 2764 }; 2765 var jwControllerHeight = 20; 2766 S.flv = function(obj, id) { 2767 this.obj = obj; 2768 this.id = id; 2769 this.height = obj.height ? parseInt(obj.height, 10) : 300; 2770 if (S.options.showMovieControls) { 2771 this.height += jwControllerHeight 2772 } 2773 this.width = obj.width ? parseInt(obj.width, 10) : 300 2774 }; 2775 S.flv.ext = ["flv", "m4v"]; 2776 S.flv.prototype = { 2777 append: function(body, dims) { 2778 var tmp = document.createElement("div"); 2779 tmp.id = this.id; 2780 body.appendChild(tmp); 2781 var height = dims.innerHeight, 2782 width = dims.innerWidth, 2783 swf = S.path + "player.swf", 2784 version = S.options.flashVersion, 2785 express = S.path + "expressInstall.swf", 2786 flashvars = apply({ 2787 file: this.obj.content, 2788 height: height, 2789 width: width, 2790 autostart: (S.options.autoplayMovies ? "true" : "false"), 2791 controlbar: (S.options.showMovieControls ? "bottom" : "none"), 2792 backcolor: "0x000000", 2793 frontcolor: "0xCCCCCC", 2794 lightcolor: "0x557722" 2795 }, S.options.flashVars), 2796 params = S.options.flashParams; 2797 S.flash.embedSWF(swf, this.id, width, height, version, express, flashvars, params) 2798 }, 2799 remove: function() { 2800 S.flash.expressInstallCallback(); 2801 S.flash.removeSWF(this.id) 2802 }, 2803 onWindowResize: function() { 2804 var dims = S.dimensions, 2805 el = get(this.id); 2806 el.height = dims.innerHeight; 2807 el.width = dims.innerWidth 2808 } 2809 }; 2810 var qtControllerHeight = 16; 2811 S.qt = function(obj, id) { 2812 this.obj = obj; 2813 this.id = id; 2814 this.height = obj.height ? parseInt(obj.height, 10) : 300; 2815 if (S.options.showMovieControls) { 2816 this.height += qtControllerHeight 2817 } 2818 this.width = obj.width ? parseInt(obj.width, 10) : 300 2819 }; 2820 S.qt.ext = ["dv", "mov", "moov", "movie", "mp4", "avi", "mpg", "mpeg"]; 2821 S.qt.prototype = { 2822 append: function(body, dims) { 2823 var opt = S.options, 2824 autoplay = String(opt.autoplayMovies), 2825 controls = String(opt.showMovieControls); 2826 var html = "<object", 2827 movie = { 2828 id: this.id, 2829 name: this.id, 2830 height: this.height, 2831 width: this.width, 2832 kioskmode: "true" 2833 }; 2834 if (S.isIE) { 2835 movie.classid = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"; 2836 movie.codebase = "http://www.apple.com/qtactivex/qtplugin.cab#ver
2836sion=6,0,2,0" 2837 } else { 2838 movie.type = "video/quicktime"; 2839 movie.data = this.obj.content 2840 } 2841 for (var m in movie) { 2842 html += " " + m + '="' + movie[m] + '"' 2843 } 2844 html += ">"; 2845 var params = { 2846 src: this.obj.content, 2847 scale: "aspect", 2848 controller: controls, 2849 autoplay: autoplay 2850 }; 2851 for (var p in params) { 2852 html += '<param name="' + p + '" value="' + params[p] + '">' 2853 } 2854 html += "</object>"; 2855 body.innerHTML = html 2856 }, 2857 remove: function() { 2858 try { 2859 document[this.id].Stop() 2860 } catch (e) {} 2861 var el = get(this.id); 2862 if (el) { 2863 remove(el) 2864 } 2865 } 2866 }; 2867 var wmpControllerHeight = (S.isIE ? 70 : 45); 2868 S.wmp = function(obj, id) { 2869 this.obj = obj; 2870 this.id = id; 2871 this.height = obj.height ? parseInt(obj.height, 10) : 300; 2872 if (S.options.showMovieControls) { 2873 this.height += wmpControllerHeight 2874 } 2875 this.width = obj.width ? parseInt(obj.width, 10) : 300 2876 }; 2877 S.wmp.ext = ["asf", "avi", "mpg", "mpeg", "wm", "wmv"]; 2878 S.wmp.prototype = { 2879 append: function(body, dims) { 2880 var opt = S.options, 2881 autoplay = opt.autoplayMovies ? 1 : 0; 2882 var movie = '<object id="' + this.id + '" name="' + this.id + '" height="' + this.height + '" width="' + this.width + '"', 2883 params = {
2884 autostart: opt.autoplayMovies ? 1 : 0 2885 }; 2886 if (S.isIE) { 2887 movie += ' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"'; 2888 params.url = this.obj.content; 2889 params.uimode = opt.showMovieControls ? "full" : "none" 2890 } else { 2891 movie += ' type="video/x-ms-wmv"'; 2892 movie += ' data="' + this.obj.content + '"'; 2893 params.showcontrols = opt.showMovieControls ? 1 : 0 2894 } 2895 movie += ">"; 2896 for (var p in params) { 2897 movie += '<param name="' + p + '" value="' + params[p] + '">' 2898 } 2899 movie += "</object>"; 2900 body.innerHTML = movie 2901 }, 2902 remove: function() { 2903 if (S.isIE) { 2904 try { 2905 window[this.id].controls.stop(); 2906 window[this.id].URL = "movie" + now() + ".wmv"; 2907 window[this.id] = function() {} 2908 } catch (e) {} 2909 } 2910 var el = get(this.id); 2911 if (el) { 2912 setTimeout(function() { 2913 remove(el) 2914 }, 10) 2915 } 2916 } 2917 }; 2918 var overlayOn = false, 2919 visibilityCache = [], 2920 pngIds = ["sb-nav-close", "sb-nav-next", "sb-nav-play", "sb-nav-pause", "sb-nav-previous"], 2921 container, overlay, wrapper, doWindowResize = true; 2922 2923 function animate(el, property, to, duration, callback) { 2924 var isOpacity = (property == "opacity"), 2925 anim = isOpacity ? S.setOpacity : function(el, value) { 2926 el.style[property] = "" + value + "px" 2927 }; 2928 if (duration == 0 || (!isOpacity && !S.options.animate) || (isOpacity && !S.options.animateFade)) { 2929 anim(el, to); 2930 if (callback) { 2931 callback() 2932 } 2933 return 2934 } 2935 var from = parseFloat(S.getStyle(el, property)) || 0; 2936 var delta = to - from; 2937 if (delta == 0) { 2938 if (callback) { 2939 callback() 2940 } 2941 return 2942 } 2943 duration *= 1000; 2944 var begin = now(), 2945 ease = S.ease, 2946 end = begin + duration, 2947 time; 2948 var interval = setInterval(function() { 2949 time = now(); 2950 if (time >= end) { 2951 clearInterval(interval); 2952 interval = null; 2953 anim(el, to); 2954 if (callback) { 2955 callback() 2956 } 2957 } else { 2958 anim(el, from + ease((time - begin) / duration) * delta) 2959 } 2960 }, 10) 2961 } 2962 2963 function setSize() { 2964 container.style.height = S.getWindowSize("Height") + "px"; 2965 container.style.width = S.getWindowSize("Width") + "px" 2966 } 2967 2968 function setPosition() { 2969 container.style.top = document.documentElement.scrollTop + "px"; 2970 container.style.left = document.documentElement.scrollLeft + "px" 2971 } 2972 2973 function toggleTroubleElements(on) { 2974 if (on) { 2975 each(visibilityCache, function(i, el) { 2976 el[0].style.visibility = el[1] || "" 2977 }) 2978 } else { 2979 visibilityCache = []; 2980 each(S.options.troubleElements, function(i, tag) { 2981 each(document.getElementsByTagName(tag), function(j, el) { 2982 visibilityCache.push([el, el.style.visibility]); 2983 el.style.visibility = "hidden" 2984 }) 2985 }) 2986 } 2987 } 2988 2989 function toggleNav(id, on) { 2990 var el = get("sb-nav-" + id); 2991 if (el) { 2992 el.style.display = on ? "" : "none" 2993 } 2994 } 2995 2996 function toggleLoading(on, callback) { 2997 var loading = get("sb-loading"), 2998 playerName = S.getCurrent().player, 2999 anim = (playerName == "img" || playerName == "html"); 3000 if (on) { 3001 S.setOpacity(loading, 0); 3002 loading.style.display = "block"; 3003 var wrapped = function() { 3004 S.clearOpacity(loading); 3005 if (callback) { 3006 callback() 3007 } 3008 }; 3009 if (anim) { 3010 animate(loading, "opacity", 1, S.options.fadeDuration, wrapped) 3011 } else { 3012 wrapped() 3013 } 3014 } else { 3015 var wrapped = function() { 3016 loading.style.display = "none"; 3017 S.clearOpacity(loading); 3018 if (callback) { 3019 callback() 3020 } 3021 }; 3022 if (anim) { 3023 animate(loading, "opacity", 0, S.options.fadeDuration, wrapped) 3024 } else { 3025 wrapped() 3026 } 3027 } 3028 } 3029 3030 function buildBars(callback) { 3031 var obj = S.getCurrent(); 3032 get("sb-title-inner").innerHTML = obj.title || ""; 3033 var close, next, play, pause, previous; 3034 if (S.options.displayNav) { 3035 close = true; 3036 var len = S.gallery.length; 3037 if (len > 1) { 3038 if (S.options.continuous) { 3039 next = previous = true 3040 } else { 3041 next = (len - 1) > S.current; 3042 previous = S.current > 0 3043 } 3044 } 3045 if (S.options.slideshowDelay > 0 && S.hasNext()) { 3046 pause = !S.isPaused(); 3047 play = !pause 3048 } 3049 } else { 3050 close = next = play = pause = previous = false 3051 } 3052 toggleNav("close", close); 3053 toggleNav("next", next); 3054 toggleNav("play", play); 3055 toggleNav("pause", pause); 3056 toggleNav("previous", previous); 3057 var counter = ""; 3058 if (S.options.displayCounter && S.gallery.length > 1) { 3059 var len = S.gallery.length; 3060 if (S.options.counterType == "skip") { 3061 var i = 0, 3062 end = len, 3063 limit = parseInt(S.options.counterLimit) || 0; 3064 if (limit < len && limit > 2) { 3065 var h = Math.floor(limit / 2); 3066 i = S.current - h; 3067 if (i < 0) { 3068 i += len 3069 } 3070 end = S.current + (limit - h); 3071 if (end > len) { 3072 end -= len 3073 } 3074 } 3075 while (i != end) { 3076 if (i == len) { 3077 i = 0 3078 } 3079 counter += '<a onclick="Shadowbox.change(' + i + ');"'; 3080 if (i == S.current) { 3081 counter += ' class="sb-counter-current"' 3082 } 3083 counter += ">" + (++i) + "</a>" 3084 } 3085 } else { 3086 counter = [S.current + 1, S.lang.of, len].join(" ") 3087 } 3088 } 3089 get("sb-counter").innerHTML = counter; 3090 callback() 3091 } 3092 3093 function showBars(callback) { 3094 var titleInner = get("sb-title-inner"), 3095 infoInner = get("sb-info-inner"), 3096 duration = 0.35; 3097 titleInner.style.visibility = infoInner.style.visibility = ""; 3098 if (titleInner.innerHTML != "") { 3099 animate(titleInner, "marginTop", 0, duration) 3100 } 3101 animate(infoInner, "marginTop", 0, duration, callback) 3102 } 3103 3104 function hideBars(anim, callback) { 3105 var title = get("sb-title"), 3106 info = get("sb-info"),
3107 titleHeight = title.offsetHeight, 3108 infoHeight = info.offsetHeight, 3109 titleInner = get("sb-title-inner"), 3110 infoInner = get("sb-info-inner"), 3111 duration = (anim ? 0.35 : 0); 3112 animate(titleInner, "marginTop", titleHeight, duration); 3113 animate(infoInner, "marginTop", infoHeight * -1, duration, function() { 3114 titleInner.style.visibility = infoInner.style.visibility = "hidden"; 3115 callback() 3116 }) 3117 } 3118 3119 function adjustHeight(height, top, anim, callback) { 3120 var wrapperInner = get("sb-wrapper-inner"), 3121 duration = (anim ? S.options.resizeDuration : 0); 3122 animate(wrapper, "top", top, duration); 3123 animate(wrapperInner, "height", height, duration, callback) 3124 } 3125 3126 function adjustWidth(width, left, anim, callback) { 3127 var duration = (anim ? S.options.resizeDuration : 0); 3128 animate(wrapper, "left", left, duration); 3129 animate(wrapper, "width", width, duration, callback) 3130 } 3131 3132 function setDimensions(height, width) { 3133 var bodyInner = get("sb-body-inner"), 3134 height = parseInt(height), 3135 width = parseInt(width), 3136 topBottom = wrapper.offsetHeight - bodyInner.offsetHeight, 3137 leftRight = wrapper.offsetWidth - bodyInner.offsetWidth, 3138 maxHeight = overlay.offsetHeight, 3139 maxWidth = overlay.offsetWidth, 3140 padding = parseInt(S.options.viewportPadding) || 20, 3141 preserveAspect = (S.player && S.options.handleOversize != "drag"); 3142 return S.setDimensions(height, width, maxHeight, maxWidth, topBottom, leftRight, padding, preserveAspect) 3143 } 3144 var K = {}; 3145 K.markup = '<div id="sb-container"><div id="sb-overlay"></div><div id="sb-wrapper"><div id="sb-title"><div id="sb-title-inner"></div></div><div id="sb-wrapper-inner"><div id="sb-body"><div id="sb-body-inner"></div><div id="sb-loading"><div id="sb-loading-inner"><span>{loading}</span></div></div></div></div><div id="sb-info"><div id="sb-info-inner"><div id="sb-counter"></div><div id="sb-nav"><a id="sb-nav-close" title="{close}" onclick="Shadowbox.close()"></a><a id="sb-nav-next" title="{next}" onclick="Shadowbox.next()"></a><a id="sb-nav-play" title="{play}" onclick="Shadowbox.play()"></a><a id="sb-nav-pause" title="{pause}" onclick="Shadowbox.pause()"></a><a id="sb-nav-previous" title="{previous}" onclick="Shadowbox.previous()"></a></div></div></div></div></div>'; 3146 K.options = { 3147 animSequence: "sync", 3148 counterLimit: 10, 3149 counterType: "default", 3150 displayCounter: true, 3151 displayNav: true, 3152 fadeDuration: 0.35, 3153 initialHeight: 160, 3154 initialWidth: 320, 3155 modal: false, 3156 overlayColor: "#000", 3157 overlayOpacity: 0.5, 3158 resizeDuration: 0.35, 3159 showOverlay: true, 3160 troubleElements: ["select", "object", "embed", "canvas"] 3161 }; 3162 K.init = function() { 3163 S.appendHTML(document.body, sprintf(K.markup, S.lang)); 3164 K.body = get("sb-body-inner"); 3165 container = get("sb-container"); 3166 overlay = get("sb-overlay"); 3167 wrapper = get("sb-wrapper"); 3168 if (!supportsFixed) { 3169 container.style.position = "absolute" 3170 } 3171 if (!supportsOpacity) { 3172 var el, m, re = /url\("(.*\.png)"\)/; 3173 each(pngIds, function(i, id) { 3174 el = get(id); 3175 if (el) { 3176 m = S.getStyle(el, "backgroundImage").match(re); 3177 if (m) { 3178 el.style.backgroundImage = "none"; 3179 el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=" + m[1] + ",sizingMethod=scale);" 3180 } 3181 } 3182 }) 3183 } 3184 var timer; 3185 addEvent(window, "resize", function() { 3186 if (timer) { 3187 clearTimeout(timer); 3188 timer = null 3189 } 3190 if (open) { 3191 timer = setTimeout(K.onWindowResize, 10) 3192 } 3193 }) 3194 }; 3195 K.onOpen = function(obj, callback) { 3196 doWindowResize = false;
3197 container.style.display = "block"; 3198 setSize(); 3199 var dims = setDimensions(S.options.initialHeight, S.options.initialWidth); 3200 adjustHeight(dims.innerHeight, dims.top); 3201 adjustWidth(dims.width, dims.left); 3202 if (S.options.showOverlay) { 3203 overlay.style.backgroundColor = S.options.overlayColor; 3204 S.setOpacity(overlay, 0); 3205 if (!S.options.modal) { 3206 addEvent(overlay, "click", S.close) 3207 } 3208 overlayOn = true 3209 } 3210 if (!supportsFixed) { 3211 setPosition(); 3212 addEvent(window, "scroll", setPosition) 3213 } 3214 toggleTroubleElements(); 3215 container.style.visibility = "visible"; 3216 if (overlayOn) { 3217 animate(overlay, "opacity", S.options.overlayOpacity, S.options.fadeDuration, callback) 3218 } else { 3219 callback() 3220 } 3221 }; 3222 K.onLoad = function(changing, callback) { 3223 toggleLoading(true); 3224 while (K.body.firstChild) { 3225 remove(K.body.firstChild) 3226 } 3227 hideBars(changing, function() { 3228 if (!open) { 3229 return 3230 } 3231 if (!changing) { 3232 wrapper.style.visibility = "visible" 3233 } 3234 buildBars(callback) 3235 }) 3236 }; 3237 K.onReady = function(callback) { 3238 if (!open) { 3239 return 3240 } 3241 var player = S.player, 3242 dims = setDimensions(player.height, player.width); 3243 var wrapped = function() { 3244 showBars(callback) 3245 }; 3246 switch (S.options.animSequence) { 3247 case "hw": 3248 adjustHeight(dims.innerHeight, dims.top, true, function() { 3249 adjustWidth(dims.width, dims.left, true, wrapped) 3250 }); 3251 break; 3252 case "wh": 3253 adjustWidth(dims.width, dims.left, true, function() { 3254 adjustHeight(dims.innerHeight, dims.top, true, wrapped) 3255 }); 3256 break; 3257 default: 3258 adjustWidth(dims.width, dims.left, true); 3259 adjustHeight(dims.innerHeight, dims.top, true, wrapped) 3260 } 3261 }; 3262 K.onShow = function(callback) { 3263 toggleLoading(false, callback); 3264 doWindowResize = true 3265 }; 3266 K.onClose = function() { 3267 if (!supportsFixed) { 3268 removeEvent(window, "scroll", setPosition) 3269 } 3270 removeEvent(overlay, "click", S.close); 3271 wrapper.style.visibility = "hidden"; 3272 var callback = function() { 3273 container.style.visibility = "hidden"; 3274 container.style.display = "none"; 3275 toggleTroubleElements(true) 3276 }; 3277 if (overlayOn) { 3278 animate(overlay, "opacity", 0, S.options.fadeDuration, callback) 3279 } else { 3280 callback() 3281 } 3282 }; 3283 K.onPlay = function() { 3284 toggleNav("play", false); 3285 toggleNav("pause", true) 3286 }; 3287 K.onPause = function() { 3288 toggleNav("pause", false); 3289 toggleNav("play", true) 3290 }; 3291 K.onWindowResize = function() { 3292 if (!doWindowResize) { 3293 return 3294 } 3295 setSize(); 3296 var player = S.player, 3297 dims = setDimensions(player.height, player.width); 3298 adjustWidth(dims.width, dims.left); 3299 adjustHeight(dims.innerHeight, dims.top); 3300 if (player.onWindowResize) { 3301 player.onWindowResize() 3302 } 3303 }; 3304 S.skin = K; 3305 window.Shadowbox = S 3306})(window);
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.