﻿(function (b, ba) { function c(a, e) { a = a ? ' id="' + m + a + '"' : ""; return b("<div" + a + (e ? ' style="' + e + '"' : "") + "/>") } function p(a, b) { b = b === "x" ? i.width() : i.height(); return typeof a === "string" ? Math.round(/%/.test(a) ? b / 100 * parseInt(a, 10) : parseInt(a, 10)) : a } function L(K) { return a.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(K) } function W(a) { for (var e in a) b.isFunction(a[e]) && e.substring(0, 2) !== "on" && (a[e] = a[e].call(g)); a.rel = a.rel || g.rel || "nofollow"; a.href = a.href || b(g).attr("href"); a.title = a.title || g.title; return a } function u(a, e) { e && e.call(g); b.event.trigger(a) } function ca() { var b, e = m + "Slideshow_", d = "click." + m, c, l; a.slideshow && j[1] && (c = function () { A.text(a.slideshowStop).unbind(d).bind(M, function () { if (h < j.length - 1 || a.loop) b = setTimeout(f.next, a.slideshowSpeed) }).bind(N, function () { clearTimeout(b) }).one(d + " " + G, l); o.removeClass(e + "off").addClass(e + "on"); b = setTimeout(f.next, a.slideshowSpeed) }, l = function () { clearTimeout(b); A.text(a.slideshowStart).unbind([M, N, G, d].join(" ")).one(d, c); o.removeClass(e + "on").addClass(e + "off") }, a.slideshowAuto ? c() : l()) } function X(K) { if (!H) { g = K; a = W(b.extend({}, b.data(g, r))); j = b(g); h = 0; a.rel !== "nofollow" && (j = b("." + B).filter(function () { return (b.data(this, r).rel || this.rel) === a.rel }), h = j.index(g), h === -1 && (j = j.add(g), h = j.length - 1)); if (!t) { t = y = !0; o.show(); if (a.returnFocus) try { g.blur(), b(g).one(Y, function () { try { this.focus() } catch (a) { } }) } catch (e) { } n.css({ opacity: +a.opacity, cursor: a.overlayClose ? "pointer" : "auto" }).show(); a.w = p(a.initialWidth, "x"); a.h = p(a.initialHeight, "y"); f.position(0); O && i.bind("resize." + I + " scroll." + I, function () { n.css({ width: i.width(), height: i.height(), top: i.scrollTop(), left: i.scrollLeft() }) }).trigger("scroll." + I); u(Z, a.onOpen); P.add(C).add(D).add(A).add(Q).hide(); R.html(a.close).show() } f.load(!0) } } var $ = { transition: "elastic", speed: 300, width: !1, initialWidth: "600", innerWidth: !1, maxWidth: !1, height: !1, initialHeight: "450", innerHeight: !1, maxHeight: !1, scalePhotos: !0, scrolling: !0, inline: !1, html: !1, iframe: !1, photo: !1, href: !1, title: !1, rel: !1, opacity: 0.9, preloading: !0, current: "Image {current} of {total}", previous: "previous", next: "next", close: "close", open: !1, returnFocus: !0, loop: !0, slideshow: !1, slideshowAuto: !0, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: !1, onLoad: !1, onComplete: !1, onCleanup: !1, onClosed: !1, overlayClose: !0, escKey: !0, arrowKey: !0 }, r = "colorbox", m = "cbox", Z = m + "_open", N = m + "_load", M = m + "_complete", G = m + "_cleanup", Y = m + "_closed", J = m + "_purge", aa = m + "_loaded", z = b.browser.msie && !b.support.opacity, O = z && b.browser.version < 7, I = m + "_IE6", n, o, v, k, S, T, U, V, j, i, l, E, F, Q, P, A, D, C, R, w, x, q, s, g, h, a, t, y, H = !1, f, B = m + "Element"; f = b.fn[r] = b[r] = function (a, e) { var d = this, c; if (!d[0] && d.selector) return d; a = a || {}; if (e) a.onComplete = e; if (!d[0] || d.selector === void 0) d = b("<a/>"), a.open = !0; d.each(function () { b.data(this, r, b.extend({}, b.data(this, r) || $, a)); b(this).addClass(B); b(this).bind("contextmenu", function (a) { a.preventDefault() }) }); c = a.open; b.isFunction(c) && (c = c.call(d)); c && X(d[0]); return d }; f.init = function () { i = b(ba); o = c().attr({ id: r, "class": z ? m + "IE" : "" }); n = c("Overlay", O ? "position:absolute" : "").hide(); v = c("Wrapper"); k = c("Content").append(l = c("LoadedContent", "width:0; height:0; overflow:hidden"), F = c("LoadingOverlay").add(c("LoadingGraphic")), Q = c("Title"), P = c("Current"), D = c("Next"), C = c("Previous"), A = c("Slideshow").bind(Z, ca), R = c("Close")); v.append(c().append(c("TopLeft"), S = c("TopCenter"), c("TopRight")), c(!1, "clear:left").append(T = c("MiddleLeft"), k, U = c("MiddleRight")), c(!1, "clear:left").append(c("BottomLeft"), V = c("BottomCenter"), c("BottomRight"))).children().children().css({ "float": "left" }); E = c(!1, "position:absolute; width:9999px; visibility:hidden; display:none"); b("body").prepend(n, o.append(v, E)); k.children().hover(function () { b(this).addClass("hover") }, function () { b(this).removeClass("hover") }).addClass("hover"); w = S.height() + V.height() + k.outerHeight(!0) - k.height(); x = T.width() + U.width() + k.outerWidth(!0) - k.width(); q = l.outerHeight(!0); s = l.outerWidth(!0); o.css({ "padding-bottom": w, "padding-right": x }).hide(); D.click(f.next); C.click(f.prev); R.click(f.close); k.children().removeClass("hover"); b("." + B).live("click", function (a) { var e = b(this).attr("href"), d = e; e.indexOf("colorbox") == -1 && (e += e.indexOf("?") == -1 ? "?colorbox=true" : "&colorbox=true"); b(this).attr("href", e); if (a.button !== 0 && typeof a.button !== "undefined" || a.ctrlKey || a.shiftKey || a.altKey) return a.preventDefault(), a.stopPropagation(), b(this).attr("href", d), !1; else a.preventDefault(), X(this), b(this).attr("href", d) }); n.click(function () { a.overlayClose && f.close() }); b(document).bind("keydown", function (b) { t && a.escKey && b.keyCode === 27 && (b.preventDefault(), f.close()); if (t && a.arrowKey && !y && j[1]) if (b.keyCode === 37 && (h || a.loop)) b.preventDefault(), C.click(); else if (b.keyCode === 39 && (h < j.length - 1 || a.loop)) b.preventDefault(), D.click() }) }; f.remove = function () { o.add(n).remove(); b("." + B).die("click").removeData(r).removeClass(B) }; f.position = function (b, e) { function d(a) { S[0].style.width = V[0].style.width = k[0].style.width = a.style.width; F[0].style.height = F[1].style.height = k[0].style.height = T[0].style.height = U[0].style.height = a.style.height } var c, f = Math.max(document.documentElement.clientHeight - a.h - q - w, 0) / 2 + i.scrollTop(), h = Math.max(i.width() - a.w - s - x, 0) / 2 + i.scrollLeft(); c = o.width() === a.w + s && o.height() === a.h + q ? 0 : b; v[0].style.width = v[0].style.height = "9999px"; o.dequeue().animate({ width: a.w + s, height: a.h + q, top: f, left: h }, { duration: c, complete: function () { d(this); y = !1; v[0].style.width = a.w + s + x + "px"; v[0].style.height = a.h + q + w + "px"; e && e() }, step: function () { d(this) } }) }; f.resize = function (b) { if (t) { b = b || {}; if (b.width) a.w = p(b.width, "x") - s - x; if (b.innerWidth) a.w = p(b.innerWidth, "x"); l.css({ width: a.w }); if (b.height) a.h = p(b.height, "y") - q - w; if (b.innerHeight) a.h = p(b.innerHeight, "y"); if (!b.innerHeight && !b.height) b = l.wrapInner("<div style='overflow:auto'></div>").children(), a.h = b.height(), b.replaceWith(b.children()); l.css({ height: a.h }); f.position(a.transition === "none" ? 0 : a.speed) } }; f.prep = function (g) { function e(c) { var e, g, k, n, q = j.length, s = a.loop; f.position(c, function () { function c() { z && o[0].style.removeAttribute("filter") } if (t) { z && d && l.fadeIn(100); l.show(); u(aa); Q.show().html(a.title); if (q > 1 && (typeof a.current === "string" && P.html(a.current.replace(/\{current\}/, h + 1).replace(/\{total\}/, q)).show(), D[s || h < q - 1 ? "show" : "hide"]().html(a.next), C[s || h ? "show" : "hide"]().html(a.previous), e = h ? j[h - 1] : j[q - 1], k = h < q - 1 ? j[h + 1] : j[0], a.slideshow && A.show(), a.preloading)) { n = b.data(k, r).href || k.href; g = b.data(e, r).href || e.href; n = b.isFunction(n) ? n.call(k) : n; g = b.isFunction(g) ? g.call(e) : g; if (L(n)) b("<img/>")[0].src = n; if (L(g)) b("<img/>")[0].src = g } F.hide(); a.transition === "fade" ? o.fadeTo(p, 1, function () { c() }) : c(); i.bind("resize." + m, function () { f.position(0) }); u(M, a.onComplete) } }) } if (t) { var d, p = a.transition === "none" ? 0 : a.speed; i.unbind("resize." + m); l.remove(); l = c("LoadedContent").html(g); l.hide().appendTo(E.show()).css({ width: function () { a.w = a.w || l.width(); a.w = a.mw && a.mw < a.w ? a.mw : a.w; return a.w } (), overflow: a.scrolling ? "auto" : "hidden" }).css({ height: function () { a.h = a.h || l.height(); a.h = a.mh && a.mh < a.h ? a.mh : a.h; return a.h } () }).prependTo(k); E.hide(); b("#" + m + "Photo").css({ cssFloat: "none", marginLeft: "auto", marginRight: "auto" }); if (O) b("select").not(o.find("select")).filter(function () { return this.style.visibility !== "hidden" }).css({ visibility: "hidden" }).one(G, function () { this.style.visibility = "inherit" }); a.transition === "fade" ? o.fadeTo(p, 0, function () { e(0) }) : e(p) } }; f.load = function (n) { var e, d, k, i = f.prep; y = !0; g = j[h]; n || (a = W(b.extend({}, b.data(g, r)))); u(J); u(N, a.onLoad); a.h = a.height ? p(a.height, "y") - q - w : a.innerHeight && p(a.innerHeight, "y"); a.w = a.width ? p(a.width, "x") - s - x : a.innerWidth && p(a.innerWidth, "x"); a.mw = a.w; a.mh = a.h; if (a.maxWidth) a.mw = p(a.maxWidth, "x") - s - x, a.mw = a.w && a.w < a.mw ? a.w : a.mw; if (a.maxHeight) a.mh = p(a.maxHeight, "y") - q - w, a.mh = a.h && a.h < a.mh ? a.h : a.mh; e = a.href; F.show(); a.inline ? (c().hide().insertBefore(b(e)[0]).one(J, function () { b(this).replaceWith(l.children()) }), i(b(e))) : a.iframe ? (o.one(aa, function () { var c = b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0]; c.name = m + +new Date; c.src = a.href; if (!a.scrolling) c.scrolling = "no"; if (z) c.allowtransparency = "true"; b(c).appendTo(l).one(J, function () { c.src = "//about:blank" }) }), i(" ")) : a.html ? i(a.html) : L(e) ? (d = new Image, d.onload = function () { var c; d.onload = null; d.id = m + "Photo"; b(d).css({ border: "none", display: "block", cssFloat: "left" }); a.scalePhotos && (k = function () { d.height -= d.height * c; d.width -= d.width * c }, a.mw && d.width > a.mw && (c = (d.width - a.mw) / d.width, k()), a.mh && d.height > a.mh && (c = (d.height - a.mh) / d.height, k())); if (a.h) d.style.marginTop = Math.max(a.h - d.height, 0) / 2 + "px"; j[1] && (h < j.length - 1 || a.loop) && b(d).css({ cursor: "pointer" }).click(f.next); if (z) d.style.msInterpolationMode = "bicubic"; setTimeout(function () { i(d) }, 1) }, setTimeout(function () { d.src = e }, 1)) : e && E.load(e, function (a, c, d) { i(c === "error" ? "Request unsuccessful: " + d.statusText : b(this).children()) }) }; f.next = function () { y || (h = h < j.length - 1 ? h + 1 : 0, f.load()) }; f.prev = function () { y || (h = h ? h - 1 : j.length - 1, f.load()) }; f.close = function () { t && !H && (H = !0, t = !1, u(G, a.onCleanup), i.unbind("." + m + " ." + I), n.fadeTo("fast", 0), o.stop().fadeTo("fast", 0, function () { u(J); l.remove(); o.add(n).css({ opacity: 1, cursor: "auto" }).hide(); setTimeout(function () { H = !1; u(Y, a.onClosed) }, 1) })) }; f.element = function () { return b(g) }; f.settings = $; b(f.init) })(jQuery, this);
