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