﻿/*
ColorBox v1.2.0 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
(c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
document.write("\r\n<style type='text/css'>\r\n#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}\r\n#cboxOverlay{position:fixed; width:100%; height:100%;}\r\n#cboxMiddleLeft, #cboxBottomLeft{clear:left;}\r\n#cboxContent{position:relative; overflow:visible;}\r\n#cboxLoadedContent{overflow:auto; width:0; height:0;}\r\n#cboxLoadedContent iframe{display:block; width:100%; height:100%; border:0;}\r\n#cboxTitle{margin:0;}\r\n#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}\r\n#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}\r\n</style>\r\n"); (function(g) { var D, h, k, c, q, a, j, G, z, w, s, e, C, A, d, u, p, v, x, m, i, f, F, t, b, l, E; function n() { i.css({ position: "absolute", width: s.width(), height: s.height(), top: s.scrollTop(), left: s.scrollLeft() }) } function o() { var H; function I() { w.text(D.slideshowStop).bind("cbox_complete", function() { z = setTimeout(g.fn.colorbox.next, D.slideshowSpeed) }).bind("cbox_load", function() { clearTimeout(z) }).one("click", function() { H(); g(this).removeClass("hover") }); p.removeClass("cboxSlideshow_off").addClass("cboxSlideshow_on") } H = function() { clearTimeout(z); w.text(D.slideshowStart).unbind("cbox_complete cbox_load").one("click", function() { I(); z = setTimeout(g.fn.colorbox.next, D.slideshowSpeed); g(this).removeClass("hover") }); p.removeClass("cboxSlideshow_on").addClass("cboxSlideshow_off") }; if (D.slideshow !== false && G.length > 1) { if (D.slideshowAuto === true) { I() } else { H() } } } function r() { if (g("#cboxInlineTemp").length > 0) { F.children().insertAfter("#cboxInlineTemp") } } function B(H, I) { return (typeof H == "string") ? (H.match(/%/) ? (I / 100) * parseInt(H, 10) : parseInt(H, 10)) : H } function y(H) { return H.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i) } g(function() { g.fn.colorbox.init() }); g.fn.colorbox = function(I, H) { g(this).unbind("click.colorbox").bind("click.colorbox", function(J) { this.blur(); D = g.extend({}, g.fn.colorbox.settings, I); if (H) { h = H } else { h = function() { } } if (D.width) { D.width = B(D.width, document.documentElement.clientWidth) } if (D.height) { D.height = B(D.height, document.documentElement.clientHeight) } if (this.rel && "nofollow" != this.rel) { G = g("a[rel='" + this.rel + "']"); j = g(G).index(this) } else { G = g(this); j = 0 } if (p.data("open") !== true) { g.event.trigger("cbox_open"); e.html(D.close); i.css({ opacity: D.opacity }).show(); p.data("open", true); g.fn.colorbox.position(B(D.initialWidth, document.documentElement.clientWidth), B(D.initialHeight, document.documentElement.clientHeight), 0); if (g.browser.msie && g.browser.version < 7) { s.bind("resize scroll", n) } } o(); g.fn.colorbox.load(); if (D.overlayClose === true) { i.css({ cursor: "pointer" }).click(g.fn.colorbox.close) } J.preventDefault() }); if (I && I.open && p.data("open") !== true) { g(this).triggerHandler("click.colorbox") } return this.each(function() { }) }; g.fn.colorbox.init = function() { s = g(window); g("body").prepend(i = g('<div id="cboxOverlay" />').hide(), p = g('<div id="colorbox" />')); v = g('<div id="cboxWrapper" />').appendTo(p).append(g("<div/>").append(g('<div id="cboxTopLeft"/>'), t = g('<div id="cboxTopCenter"/>'), g('<div id="cboxTopRight"/>')), b = g('<div id="cboxMiddleLeft" />'), f = g('<div id="cboxContent" />'), l = g('<div id="cboxMiddleRight" />'), g("<div/>").append(g('<div id="cboxBottomLeft"/>'), E = g('<div id="cboxBottomCenter"/>'), g('<div id="cboxBottomRight"/>'))); v.find("[id]").css({ "float": "left" }); f.append(F = g('<div id="cboxLoadedContent" />'), x = g('<div id="cboxLoadingOverlay" />'), m = g('<div id="cboxLoadingGraphic" />'), u = g('<div id="cboxTitle" />'), d = g('<div id="cboxCurrent" />'), w = g('<div id="cboxSlideshow" />'), C = g('<div id="cboxNext" />').click(g.fn.colorbox.next), A = g('<div id="cboxPrevious" />').click(g.fn.colorbox.prev), e = g('<div id="cboxClose" />').click(g.fn.colorbox.close)); f.children().addClass("hover").mouseover(function() { g(this).addClass("hover") }).mouseout(function() { g(this).removeClass("hover") }).hide(); q = t.height() + E.height() + f.outerHeight(true) - f.height(); a = b.width() + l.width() + f.outerWidth(true) - f.width(); c = F.outerHeight(true); k = F.outerWidth(true); p.css({ "padding-bottom": q, "padding-right": a }).hide(); g().bind("keydown.cbox_close", function(H) { if (H.keyCode == 27) { H.preventDefault(); e.click() } }); f.children().removeClass("hover") }; g.fn.colorbox.next = function() { j = j < G.length - 1 ? j + 1 : 0; g.fn.colorbox.load() }; g.fn.colorbox.prev = function() { j = j > 0 ? j - 1 : G.length - 1; g.fn.colorbox.load() }; g.fn.colorbox.position = function(K, J, I, L) { var M = document.documentElement.clientHeight; var O = M / 2 - J / 2; var N = document.documentElement.clientWidth / 2 - K / 2; if (J > M) { O -= (J - M) } if (O < 0) { O = 0 } if (N < 0) { N = 0 } O += s.scrollTop(); N += s.scrollLeft(); K = K - a; J = J - q; v[0].style.width = v[0].style.height = "9999px"; function P(Q) { t[0].style.width = E[0].style.width = f[0].style.width = Q.style.width; m[0].style.height = x[0].style.height = f[0].style.height = b[0].style.height = l[0].style.height = Q.style.height } var H = (p.width() === K && p.height() === J) ? 0 : I; p.dequeue().animate({ height: J, width: K, top: O, left: N }, { duration: H, complete: function() { P(this); v[0].style.width = (K + a) + "px"; v[0].style.height = (J + q) + "px"; if (L) { L() } if (g.browser.msie && g.browser.version < 7) { n() } }, step: function() { P(this) } }) }; g.fn.colorbox.dimensions = function(J) { s.unbind("resize.cbox_resize"); if (p.data("open") !== true) { return false } var M = D.transition == "none" ? 0 : D.speed; F.remove(); F = g(J); F.hide().appendTo("body").css({ width: (D.width) ? D.width - k - a : F.width() }).css({ height: (D.height) ? D.height - c - q : F.height() }).attr({ id: "cboxLoadedContent" }).prependTo(f); if (g.browser.msie && g.browser.version < 7) { g("select").not(g("#colorbox select")).css({ visibility: "hidden" }) } if (g("#cboxPhoto").length > 0 && D.height) { var I = (parseInt(F[0].style.height, 10) - parseInt(g("#cboxPhoto")[0].style.height, 10)) / 2; g("#cboxPhoto").css({ marginTop: (I > 0 ? I : 0) }) } function H(O) { var N = parseInt(F[0].style.width, 10) + k + a; var P = parseInt(F[0].style.height, 10) + c + q; g.fn.colorbox.position(N, P, O, function() { if (p.data("open") !== true) { return false } f.children().show(); x.hide(); m.hide(); w.hide(); u.html(D.title ? D.title : G[j].title); if (G.length > 1) { d.html(D.current.replace(/\{current\}/, j + 1).replace(/\{total\}/, G.length)); C.html(D.next); A.html(D.previous); g().unbind("keydown.cbox_key").one("keydown.cbox_key", function(Q) { if (Q.keyCode == 37) { Q.preventDefault(); A.click() } else { if (Q.keyCode == 39) { Q.preventDefault(); C.click() } } }); if (D.slideshow !== false) { w.show() } } else { d.add(C).add(A).hide() } g("#cboxIframe").attr("src", g("#cboxIframe").attr("src")); g.event.trigger("cbox_complete"); h(); if (D.transition === "fade") { p.fadeTo(M, 1) } s.bind("resize.cbox_resize", function() { g.fn.colorbox.position(N, P, 0) }); return true }) } if (D.transition == "fade") { p.fadeTo(M, 0, function() { H(0) }) } else { H(M) } if (D.preloading !== false && G.length > 1 && y(G[j].href)) { var L, K; L = j > 0 ? G[j - 1].href : G[G.length - 1].href; K = j < G.length - 1 ? G[j + 1].href : G[0].href; return [g("<img />").attr("src", K), g("<img />").attr("src", L)] } return true }; g.fn.colorbox.load = function() { g.event.trigger("cbox_load"); x.show(); m.show(); e.show(); r(); var H = D.href ? D.href : G[j].href; if (D.inline) { g('<div id="cboxInlineTemp" />').hide().insertBefore(g(H)[0]); g.fn.colorbox.dimensions(g(H).wrapAll("<div />").parent()) } else { if (D.iframe) { g.fn.colorbox.dimensions(g("<div><iframe id='cboxIframe' name='iframe_" + new Date().getTime() + "' frameborder=0 src='" + H + "' /></div>")) } else { if (y(H)) { var I = new Image(); I.onload = function() { I.onload = null; g.fn.colorbox.dimensions(g("<div />").css({ width: this.width, height: this.height }).append(g(this).css({ width: this.width, height: this.height, display: "block", margin: "auto" }).attr("id", "cboxPhoto"))); if (G.length > 1) { g(this).css({ cursor: "pointer" }).click(g.fn.colorbox.next) } }; I.src = H } else { g("<div />").load(H, function(J, K) { if (K == "success") { g.fn.colorbox.dimensions(g(this)) } else { g.fn.colorbox.dimensions(g("<p>Request unsuccessful.</p>")) } }) } } } }; g.fn.colorbox.close = function() { clearTimeout(z); s.unbind("resize.cbox_resize"); w.unbind("cbox_complete cbox_load click"); r(); i.css({ cursor: "auto" }).fadeOut("fast").unbind("click", g.fn.colorbox.close); g().unbind("keydown.cbox_key"); if (g.browser.msie && g.browser.version < 7) { g("select").css({ visibility: "inherit" }); s.unbind("resize scroll", n) } f.children().hide(); p.stop(true, false).removeClass().fadeOut("fast", function() { F.remove(); p.removeData("open").css({ opacity: 1 }); g.event.trigger("cbox_closed") }) }; g.fn.colorbox.settings = { transition: "elastic", speed: 350, initialWidth: "400", initialHeight: "400", width: false, height: false, inline: false, iframe: false, href: false, title: false, opacity: 0.6, preloading: true, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: false, overlayClose: true, slideshow: false, slideshowAuto: true, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow"} })(jQuery);