// ColorBox v1.2.8 - a full featured, light-weight, customizable lightbox based on jQuery 1.3

(function(C) { var I, X, Y, d, A, k, b, H, c, T, F, f, s, j, m, R, l, J, t, E, Z, i, g, a, w, S, p, B, V, x, K, q = "colorbox", o = "hover", z, e, U, N, M, L, r, O, y = "cbox_open", Q = "cbox_load", u = "cbox_complete", h = "cbox_close", n = "cbox_closed", D = { transition: "elastic", speed: 350, width: false, height: false, initialWidth: "400", initialHeight: "400", maxWidth: false, maxHeight: false, resize: true, inline: false, html: false, iframe: false, photo: false, href: false, title: false, rel: false, opacity: 0.9, 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" }; C(function() { U() }); function P(aa) { if (aa.keyCode === 37) { aa.preventDefault(); J.click() } else { if (aa.keyCode === 39) { aa.preventDefault(); l.click() } } } function G(aa, ab) { ab = ab === "x" ? document.documentElement.clientWidth : document.documentElement.clientHeight; return (typeof aa === "string") ? (aa.match(/%/) ? (ab / 100) * parseInt(aa, 10) : parseInt(aa, 10)) : aa } function v(aa) { return V.photo ? true : aa.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i) } function W() { for (var aa in V) { if (typeof (V[aa]) === "function") { V[aa] = V[aa].call(p) } } } C.fn.colorbox = function(ab, aa) { if (this.length) { this.each(function() { var ac = C(this).data(q) ? C.extend({}, C(this).data(q), ab) : C.extend({}, D, ab); C(this).data(q, ac).addClass("cboxelement") }) } else { C(this).data(q, C.extend({}, D, ab)) } C(this).unbind("click.colorbox").bind("click.colorbox", function(ad) { p = this; V = C(p).data(q); W(); C().bind("keydown.cbox_close", function(ae) { if (ae.keyCode === 27) { ae.preventDefault(); t.click() } }); if (V.overlayClose === true) { I.css({ cursor: "pointer" }).one("click", O) } p.blur(); K = aa || false; var ac = V.rel || p.rel; if (ac && ac !== "nofollow") { c = C(".cboxelement").filter(function() { var ae = C(this).data(q).rel || this.rel; return (ae === ac) }); B = c.index(p); if (B < 0) { c = c.add(p); B = c.length - 1 } } else { c = C(p); B = 0 } if (!x) { C.event.trigger(y); t.html(V.close); I.css({ opacity: V.opacity }).show(); x = true; M(G(V.initialWidth, "x"), G(V.initialHeight, "y"), 0); if (C.browser.msie && C.browser.version < 7) { T.bind("resize.cboxie6 scroll.cboxie6", function() { I.css({ width: T.width(), height: T.height(), top: T.scrollTop(), left: T.scrollLeft() }) }).trigger("scroll.cboxie6") } } r(); N(); ad.preventDefault() }); if (ab && ab.open) { C(this).triggerHandler("click.colorbox") } return this }; U = function() { function aa(ab) { return C('<div id="cbox' + ab + '"/>') } T = C(window); X = C('<div id="colorbox"/>'); I = aa("Overlay").hide(); Y = aa("Wrapper"); d = aa("Content").append(F = aa("LoadedContent").css({ width: 0, height: 0 }), f = aa("LoadingOverlay"), s = aa("LoadingGraphic"), j = aa("Title"), m = aa("Current"), R = aa("Slideshow"), l = aa("Next"), J = aa("Previous"), t = aa("Close")); Y.append(C("<div/>").append(aa("TopLeft"), A = aa("TopCenter"), aa("TopRight")), C("<div/>").append(k = aa("MiddleLeft"), d, b = aa("MiddleRight")), C("<div/>").append(aa("BottomLeft"), H = aa("BottomCenter"), aa("BottomRight"))).children().children().css({ "float": "left" }); C("body").prepend(I, X.append(Y)); if (C.browser.msie && C.browser.version < 7) { I.css("position", "absolute") } d.children().addClass(o).mouseover(function() { C(this).addClass(o) }).mouseout(function() { C(this).removeClass(o) }).hide(); Z = A.height() + H.height() + d.outerHeight(true) - d.height(); i = k.width() + b.width() + d.outerWidth(true) - d.width(); g = F.outerHeight(true); a = F.outerWidth(true); X.css({ "padding-bottom": Z, "padding-right": i }).hide(); l.click(e); J.click(z); t.click(O); d.children().removeClass(o) }; M = function(ad, ac, ab, ae) { var af = document.documentElement.clientHeight, ah = af / 2 - ac / 2, ag = document.documentElement.clientWidth / 2 - ad / 2, aa; if (ac > af) { ah -= (ac - af) } if (ah < 0) { ah = 0 } if (ag < 0) { ag = 0 } ah += T.scrollTop(); ag += T.scrollLeft(); ad = ad - i; ac = ac - Z; aa = (X.width() === ad && X.height() === ac) ? 0 : ab; Y[0].style.width = Y[0].style.height = "9999px"; function ai(aj) { A[0].style.width = H[0].style.width = d[0].style.width = aj.style.width; s[0].style.height = f[0].style.height = d[0].style.height = k[0].style.height = b[0].style.height = aj.style.height } X.dequeue().animate({ height: ac, width: ad, top: ah, left: ag }, { duration: aa, complete: function() { ai(this); Y[0].style.width = (ad + i) + "px"; Y[0].style.height = (ac + Z) + "px"; if (ae) { ae() } }, step: function() { ai(this) } }) }; L = function(af) { if (!x) { return } T.unbind("resize.cbox_resize"); var ab, al, ag, ae, ac, ai, am, aa, ad = V.transition === "none" ? 0 : V.speed; F.remove(); F = C(af); function aj() { if (V.width) { ab = w } else { ab = w && w < F.width() ? w : F.width() } return ab } function ah() { if (V.height) { al = S } else { al = S && S < F.height() ? S : F.height() } return al } F.hide().appendTo("body").attr({ id: "cboxLoadedContent" }).css({ width: aj() }).css({ height: ah() }).prependTo(d); if (C.browser.msie && C.browser.version < 7) { C("select").not(C("#colorbox select")).filter(function() { return C(this).css("visibility") !== "hidden" }).css({ visibility: "hidden" }).one(h, function() { C(this).css({ visibility: "inherit" }) }) } aa = C("#cboxPhoto")[0]; if (aa && V.height) { ag = (al - parseInt(aa.style.height, 10)) / 2; aa.style.marginTop = (ag > 0 ? ag : 0) + "px" } function ak(ao) { var an = ab + a + i, ap = al + g + Z; M(an, ap, ao, function() { if (!x) { return } if (C.browser.msie) { if (aa) { F.fadeIn(100) } X.css("filter", "") } d.children().show(); C("#cboxIframeTemp").after("<iframe id='cboxIframe' name='iframe_" + new Date().getTime() + "' frameborder=0 src='" + (V.href || p.href) + "' />").remove(); f.hide(); s.hide(); R.hide(); if (c.length > 1) { m.html(V.current.replace(/\{current\}/, B + 1).replace(/\{total\}/, c.length)); l.html(V.next); J.html(V.previous); C().unbind("keydown", P).bind("keydown", P); if (V.slideshow) { R.show() } } else { m.hide(); l.hide(); J.hide() } j.html(V.title || p.title); C.event.trigger(u); if (K) { K.call(p) } if (V.transition === "fade") { X.fadeTo(ad, 1, function() { if (C.browser.msie) { d.css("filter", "") } }) } T.bind("resize.cbox_resize", function() { M(an, ap, 0) }) }) } if (V.transition === "fade") { X.fadeTo(ad, 0, function() { ak(0) }) } else { ak(ad) } if (V.preloading && c.length > 1) { ae = B > 0 ? c[B - 1] : c[c.length - 1]; ai = B < c.length - 1 ? c[B + 1] : c[0]; am = C(ai).data(q).href || ai.href; ac = C(ae).data(q).href || ae.href; if (v(am)) { C("<img />").attr("src", am) } if (v(ac)) { C("<img />").attr("src", ac) } } }; N = function() { var aa, ad, ab, ac; C.event.trigger(Q); p = c[B]; V = C(p).data(q); W(); aa = V.height ? G(V.height, "y") - g - Z : false; ad = V.width ? G(V.width, "x") - a - i : false; ab = V.href || p.href; f.show(); s.show(); t.show(); if (V.maxHeight) { S = V.maxHeight ? G(V.maxHeight, "y") - g - Z : false; aa = aa && aa < S ? aa : S } if (V.maxWidth) { w = V.maxWidth ? G(V.maxWidth, "x") - a - i : false; ad = ad && ad < w ? ad : w } S = aa; w = ad; if (V.inline) { C('<div id="cboxInlineTemp" />').hide().insertBefore(C(ab)[0]).bind(Q + " " + h, function() { F.children().insertBefore(this); C(this).remove() }); L(C(ab).wrapAll("<div/>").parent()) } else { if (V.iframe) { L(C("<div><div id='cboxIframeTemp' /></div>")) } else { if (V.html) { L(C("<div/>").html(V.html)) } else { if (v(ab)) { ac = new Image(); ac.onload = function() { ac.onload = null; if ((S || w) && V.resize) { var ag = this.width, ae = this.height, ai = 0, ah = this, af = function() { ae += ae * ai; ag += ag * ai; ah.height = ae; ah.width = ag }; if (w && ag > w) { ai = (w - ag) / ag; af() } if (S && ae > S) { ai = (S - ae) / ae; af() } } L(C("<div />").css({ width: this.width, height: this.height }).append(C(this).css({ width: this.width, height: this.height, display: "block", margin: "auto", border: 0 }).attr("id", "cboxPhoto"))); if (c.length > 1) { C(this).css({ cursor: "pointer" }).click(e) } if (C.browser.msie && C.browser.version === 7) { this.style.msInterpolationMode = "bicubic" } }; ac.src = ab } else { C("<div />").load(ab, function(ae, af) { if (af === "success") { L(C(this)) } else { L(C("<p>Request unsuccessful.</p>")) } }) } } } } }; e = function() { B = B < c.length - 1 ? B + 1 : 0; N() }; z = function() { B = B > 0 ? B - 1 : c.length - 1; N() }; r = function() { var ab, aa, ac = "cboxSlideshow_"; R.bind(h, function() { clearTimeout(aa); R.unbind() }); function ad() { R.text(V.slideshowStop).bind(u, function() { aa = setTimeout(e, V.slideshowSpeed) }).bind(Q, function() { clearTimeout(aa) }).one("click", function() { ab(); C(this).removeClass(o) }); X.removeClass(ac + "off").addClass(ac + "on") } ab = function() { clearTimeout(aa); R.text(V.slideshowStart).unbind(u + " " + Q).one("click", function() { ad(); aa = setTimeout(e, V.slideshowSpeed); C(this).removeClass(o) }); X.removeClass(ac + "on").addClass(ac + "off") }; if (V.slideshow && c.length > 1) { if (V.slideshowAuto) { ad() } else { ab() } } }; O = function() { C.event.trigger(h); x = false; C().unbind("keydown", P).unbind("keydown.cbox_close"); T.unbind("resize.cbox_resize resize.cboxie6 scroll.cboxie6"); I.css({ cursor: "auto" }).fadeOut("fast"); d.children().hide(); X.stop(true, false).removeClass().fadeOut("fast", function() { F.remove(); X.css({ opacity: 1 }); C.event.trigger(n) }) }; E = C.fn.colorbox; E.init = U; E.next = e; E.prev = z; E.close = O; E.load = N; E.position = M; E.dimensions = L; E.element = function() { return p }; E.settings = D } (jq31CB));
