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