(function (a) { var db = "active", nb = "galleria-image", N = "relative", I = "counter", mb = "px, height: ", M = "target", L = "height", K = "width", p = "stage", cb = "total", S = "50%", bb = "show", ab = "next", Z = "prev", C = "src", Y = "hidden", B = "100%", X = "mouseup", H = 200, A = "mousemove", h = "container", r = "tooltip", z = "auto", lb = "thumbnails-container", W = "thumbnails-list", w = "thumbnails", kb = "thumb-nav-left", jb = "thumb-nav-right", V = "galleria-", G = 100, o = 10, R = "string", t = "number", n = "function", v = "click", U = "touchstart", m = "opacity", T = "absolute", q = "style", Q = "top", P = "left", g = null, F = "undefined", e = false, E = "object", s = " ", j = "", d = true, i, f = this, k = f.document, qb = a(k), x = a(f), hb = d, J = navigator.userAgent.toLowerCase(), rb = f.location.hash.replace(/#\//, j), l = function () { var a = 3, b = k.createElement("div"), c = b.getElementsByTagName("i"); do b.innerHTML = "<!--[if gt IE " + ++a + "]><i></i><![endif]-->"; while (c[0]); return a > 4 ? a : i } (), y = function () { return { html: k.documentElement, body: k.body, head: k.getElementsByTagName("head")[0], title: k.title} }, sb = "data ready thumbnail loadstart loadfinish image play pause progress fullscreen_enter fullscreen_exit idle_enter idle_exit rescale lightbox_open lightbox_close lightbox_image", pb = function () { var b = []; a.each(sb.split(s), function (c, a) { b.push(a); /_/.test(a) && b.push(a.replace(/_/g, j)) }); return b } (), ib = function (b) { var c; if (typeof b !== E) return b; a.each(b, function (d, e) { if (/^[a-z]+_/.test(d)) { c = j; a.each(d.split("_"), function (b, a) { c += b > 0 ? a.substr(0, 1).toUpperCase() + a.substr(1) : a }); b[c] = e; delete b[d] } }); return b }, fb = function (b) { return a.inArray(b, pb) > -1 ? c[b.toUpperCase()] : b }, D = { trunk: {}, add: function (c, a, d, b) { b = b || e; this.clear(c); if (b) { var g = a; a = function () { g(); D.add(c, a, d) } } this.trunk[c] = f.setTimeout(a, d) }, clear: function (a) { var c = function (a) { f.clearTimeout(this.trunk[a]); delete this.trunk[a] }, b; if (!!a && a in this.trunk) c.call(D, a); else if (typeof a === F) for (b in this.trunk) this.trunk.hasOwnProperty(b) && c.call(D, b) } }, gb = [], O = [], ob = e, u = e, b = function () { var p = "complete", h = "styles"; return { array: function (a) { return Array.prototype.slice.call(a) }, create: function (c, a) { a = a || "div"; var b = k.createElement(a); b.className = c; return b }, animate: function () { var j = "revert", u = "transform", t = "transition", h = .25, r = "transitionend", w = function (c) { for (var b = "transition WebkitTransition MozTransition OTransition".split(s), a = 0; b[a]; a++) if (typeof c[b[a]] !== F) return b[a]; return e } ((document.body || document.documentElement).style), x = ({ MozTransition: r, OTransition: "oTransitionEnd", WebkitTransition: "webkitTransitionEnd", transition: r })[w], m = { _default: [h, .1, h, 1], galleria: [.645, .045, .355, 1], galleriaIn: [.55, .085, .68, .53], galleriaOut: [h, .46, .45, .94], ease: [h, 0, h, 1], linear: [h, h, .75, .75], "ease-in": [.42, 0, 1, 1], "ease-out": [0, 0, .58, 1], "ease-in-out": [.42, 0, .58, 1] }, k = function (e, d, b) { var c = {}; b = b || t; a.each("webkit moz ms o".split(s), function () { c["-" + this + "-" + b] = d }); e.css(c) }, v = function (a) { k(a, "none", t); if (c.WEBKIT) { k(a, "translate3d(0,0,0)", u); if (a.data(j)) { a.css(a.data(j)); a.data(j, g) } } }, n, l, y, p, o, i, q; return function (g, r, h) { h = a.extend({ duration: 400, complete: function () { }, stop: e }, h); g = a(g); if (!h.duration) { g.css(r); h.complete.call(g[0]); return } if (!w) { g.animate(r, h); return } if (h.stop) { g.unbind(x); v(g) } n = e; a.each(r, function (a, c) { q = g.css(a); if (b.parseValue(q) != b.parseValue(c)) n = d; g.css(a, q) }); if (!n) { f.setTimeout(function () { h.complete.call(g[0]) }, h.duration); return } l = []; y = h.easing in m ? m[h.easing] : m._default; p = s + h.duration + "ms cubic-bezier(" + y.join(",") + ")"; f.setTimeout(function () { g.one(x, function (a) { return function () { v(a); h.complete.call(a[0]) } } (g)); if (c.WEBKIT && c.TOUCH) { o = {}; i = [0, 0, 0]; a.each([P, Q], function (c, a) { if (a in r) { i[c] = b.parseValue(r[a]) - b.parseValue(g.css(a)) + "px"; o[a] = r[a]; delete r[a] } }); if (i[0] || i[1]) { g.data(j, o); l.push("-webkit-transform" + p); k(g, "translate3d(" + i.join(",") + ")", u) } } a.each(r, function (a) { l.push(a + p) }); k(g, l.join(",")); g.css(r) }, 1) } } (), forceStyles: function (b, c) { b = a(b); b.attr(q) && b.data(h, b.attr(q)).removeAttr(q); b.css(c) }, revertStyles: function () { a.each(b.array(arguments), function (c, b) { b = a(b); b.removeAttr(q); b.attr(q, j); b.data(h) && b.attr(q, b.data(h)).data(h, g) }) }, moveOut: function (a) { b.forceStyles(a, { position: T, left: -1e4 }) }, moveIn: function () { b.revertStyles.apply(b, b.array(arguments)) }, hide: function (c, e, g) { c = a(c); !c.data(m) && c.data(m, c.css(m)); var f = { opacity: 0 }; if (e) b.animate(c, f, { duration: e, complete: g, stop: d }); else c.css(f) }, show: function (c, e, g) { c = a(c); var h = parseFloat(c.data(m)) || 1, f = { opacity: h }; if (e) b.animate(c, f, { duration: e, complete: g, stop: d }); else c.css(f) }, optimizeTouch: function () { var b, c, g, f, h = {}, i = function (b) { b.preventDefault(); h = a.extend({}, b, d) }, j = function () { this.evt = h }, k = function () { this.handler.call(b, this.evt) }; return function (h) { a(h).bind(U, function (h) { b = h.target; f = d; while (b.parentNode && b != h.currentTarget && f) { c = a(b).data("events"); g = a(b).data("fakes"); if (c && v in c) { f = e; h.preventDefault(); a(b).click(i).click(); c.click.pop(); a.each(c.click, j); a(b).data("fakes", c.click); delete c.click } else if (g) { f = e; h.preventDefault(); a.each(g, k) } b = b.parentNode } }) } } (), addTimer: function () { D.add.apply(D, b.array(arguments)); return this }, clearTimer: function () { D.clear.apply(D, b.array(arguments)); return this }, wait: function (d) { d = a.extend({ until: function () { return e }, success: function () { }, error: function () { c.raise("Could not complete wait function.") }, timeout: 3e3 }, d); var i = b.timestamp(), h, g, j = function () { g = b.timestamp(); h = g - i; if (d.until(h)) { d.success(); return e } if (g >= i + d.timeout) { d.error(); return e } f.setTimeout(j, 2) }; f.setTimeout(j, 2) }, toggleQuality: function (b, a) { var c = "nearest-neighbor"; if (l !== 7 && l !== 8 || !b) return; if (typeof a === F) a = b.style.msInterpolationMode === c; b.style.msInterpolationMode = a ? "bicubic" : c }, insertStyleTag: function (b) { var a = k.createElement(q); y().head.appendChild(a); if (a.styleSheet) a.styleSheet.cssText = b; else { var c = k.createTextNode(b); a.appendChild(c) } }, loadScript: function (h, c) { var f = e, b = a("<script>").attr({ src: h, async: d }).get(0); b.onload = b.onreadystatechange = function () { var a = this; if (!f && (!a.readyState || a.readyState === "loaded" || a.readyState === p)) { f = d; b.onload = b.onreadystatechange = g; typeof c === n && c.call(a, a) } }; y().head.appendChild(b) }, parseValue: function (a) { if (typeof a === t) return a; else if (typeof a === R) { var b = a.match(/\-?\d|\./g); return b && b.constructor === Array ? b.join(j) * 1 : 0 } else return 0 }, timestamp: function () { return +new Date }, loadCSS: function (m, q, j) { var g, h = e, r; a("link[rel=stylesheet]").each(function () { if (new RegExp(m).test(this.href)) { g = this; return e } }); if (typeof q === n) { j = q; q = i } j = j || function () { }; if (g) { j.call(g, g); return g } r = k.styleSheets.length; if (hb) m += "?" + b.timestamp(); if (a("#" + q).length) { a("#" + q).attr("href", m); r--; h = d } else { g = a("<link>").attr({ rel: "stylesheet", href: m, id: q }).get(0); f.setTimeout(function () { var b = a('link[rel="stylesheet"], style'); if (b.length) b.get(0).parentNode.insertBefore(g, b[0]); else y().head.appendChild(g); if (l) { if (r >= 31) { c.raise("You have reached the browser stylesheet limit (31)", d); return } g.onreadystatechange = function () { if (!h && (!this.readyState || this.readyState === "loaded" || this.readyState === p)) h = d } } else if (!new RegExp("file://", "i").test(m)) a.ajax({ url: m, success: function () { h = d }, error: function (a) { if (a.isRejected() && c.WEBKIT) h = d } }); else h = d }, o) } typeof j === n && b.wait({ until: function () { return h && k.styleSheets.length > r }, success: function () { f.setTimeout(function () { j.call(g, g) }, G) }, error: function () { c.raise("Theme CSS could not load", d) }, timeout: 1e4 }); return g } } } (), eb = function () { var c = function (c, j, i, k) { var h = this.getOptions("easing"), g = this.getStageWidth(), d = { left: g * (c.rewind ? -1 : 1) }, f = { left: 0 }; if (i) { d.opacity = 0; f.opacity = 1 } a(c.next).css(d); b.animate(c.next, f, { duration: c.speed, complete: function (a) { return function () { j(); a.css({ left: 0 }) } } (a(c.next).add(c.prev)), queue: e, easing: h }); if (k) c.rewind = !c.rewind; if (c.prev) { d = { left: 0 }; f = { left: g * (c.rewind ? 1 : -1) }; if (i) { d.opacity = 1; f.opacity = 0 } a(c.prev).css(d); b.animate(c.prev, f, { duration: c.speed, queue: e, easing: h, complete: function () { a(this).css(m, 0) } }) } }; return { fade: function (c, d) { a(c.next).css(m, 0).show(); b.animate(c.next, { opacity: 1 }, { duration: c.speed, complete: d }); if (c.prev) { a(c.prev).css(m, 1).show(); b.animate(c.prev, { opacity: 0 }, { duration: c.speed }) } }, flash: function (c, d) { a(c.next).css(m, 0); if (c.prev) b.animate(c.prev, { opacity: 0 }, { duration: c.speed / 2, complete: function () { b.animate(c.next, { opacity: 1 }, { duration: c.speed, complete: d }) } }); else b.animate(c.next, { opacity: 1 }, { duration: c.speed, complete: d }) }, pulse: function (c, d) { c.prev && a(c.prev).hide(); a(c.next).css(m, 0).show(); b.animate(c.next, { opacity: 1 }, { duration: c.speed, complete: d }) }, slide: function () { c.apply(this, b.array(arguments)) }, fadeslide: function () { c.apply(this, b.array(arguments).concat([d])) }, doorslide: function () { c.apply(this, b.array(arguments).concat([e, d])) } } } (), c = function () { var O = "mousemove click", J = "idle", M = "resize", N = "fullscreen", D = this, k = D; D._theme = i; D._options = {}; D._playing = e; D._playtime = 5e3; D._active = g; D._queue = { length: 0 }; D._data = []; D._dom = {}; D._thumbnails = []; D._initialized = e; D._firstrun = e; D._stageWidth = 0; D._stageHeight = 0; D._target = i; D._id = Math.random(); var Q = "container stage images image-nav image-nav-left image-nav-right info info-text info-title info-description thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter tooltip", P = "current total"; a.each(Q.split(s), function (c, a) { k._dom[a] = b.create(V + a) }); a.each(P.split(s), function (c, a) { k._dom[a] = b.create(V + a, "span") }); var E = D._keyboard = { keys: { UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39, RETURN: 13, ESCAPE: 27, BACKSPACE: 8, SPACE: 32 }, map: {}, bound: e, press: function (b) { var a = b.keyCode || b.which; a in E.map && typeof E.map[a] === n && E.map[a].call(k, b) }, attach: function (b) { var a, c; for (a in b) if (b.hasOwnProperty(a)) { c = a.toUpperCase(); if (c in E.keys) E.map[E.keys[c]] = b[a]; else E.map[c] = b[a] } if (!E.bound) { E.bound = d; qb.bind("keydown", E.press) } }, detach: function () { E.bound = e; E.map = {}; qb.unbind("keydown", E.press) } }, L = D._controls = { 0: i, 1: i, active: 0, swap: function () { L.active = L.active ? 0 : 1 }, getActive: function () { return L[L.active] }, getNext: function () { return L[1 - L.active] } }, p = D._carousel = { next: k.$(jb), prev: k.$(kb), width: 0, current: 0, max: 0, hooks: [], update: function () { var b = 0, c = 0, e = [0]; a.each(k._thumbnails, function (g, f) { if (f.ready) { b += f.outerWidth || a(f.container).outerWidth(d); e[g + 1] = b; c = Math.max(c, f.outerHeight || a(f.container).outerHeight(d)) } }); k.$(w).css({ width: b, height: c }); p.max = b; p.hooks = e; p.width = k.$(W).width(); p.setClasses(); k.$(lb).toggleClass("galleria-carousel", b > p.width); p.width = k.$(W).width() }, bindControls: function () { var a; p.next.bind(v, function (b) { b.preventDefault(); if (k._options.carouselSteps === z) { for (a = p.current; a < p.hooks.length; a++) if (p.hooks[a] - p.hooks[p.current] > p.width) { p.set(a - 2); break } } else p.set(p.current + k._options.carouselSteps) }); p.prev.bind(v, function (b) { b.preventDefault(); if (k._options.carouselSteps === z) { for (a = p.current; a >= 0; a--) if (p.hooks[p.current] - p.hooks[a] > p.width) { p.set(a + 2); break } else if (a === 0) { p.set(0); break } } else p.set(p.current - k._options.carouselSteps) }) }, "set": function (a) { a = Math.max(a, 0); while (p.hooks[a - 1] + p.width >= p.max && a >= 0) a--; p.current = a; p.animate() }, getLast: function (a) { return (a || p.current) - 1 }, follow: function (a) { if (a === 0 || a === p.hooks.length - 2) { p.set(a); return } var b = p.current; while (p.hooks[b] - p.hooks[p.current] < p.width && b <= p.hooks.length) b++; if (a - 1 < p.current) p.set(a - 1); else a + 2 > b && p.set(a - b + p.current + 2) }, setClasses: function () { var a = "disabled"; p.prev.toggleClass(a, !p.current); p.next.toggleClass(a, p.hooks[p.current] + p.width >= p.max) }, animate: function () { p.setClasses(); var a = p.hooks[p.current] * -1; if (isNaN(a)) return; b.animate(k.get(w), { left: a }, { duration: k._options.carouselSpeed, easing: k._options.easing, queue: e }) } }, F = D._tooltip = { initialized: e, open: e, init: function () { F.initialized = d; var a = ".galleria-tooltip{padding:3px 8px;max-width:50%;background:#ffe;color:#000;z-index:3;position:absolute;font-size:11px;line-height:1.3opacity:0;box-shadow:0 0 2px rgba(0,0,0,.4);-moz-box-shadow:0 0 2px rgba(0,0,0,.4);-webkit-box-shadow:0 0 2px rgba(0,0,0,.4);}"; b.insertStyleTag(a); k.$(r).css(m, .8); b.hide(k.get(r)) }, move: function (i) { var j = k.getMousePosition(i).x, g = k.getMousePosition(i).y, c = k.$(r), b = j, a = g, e = c.outerHeight(d) + 1, l = c.outerWidth(d), f = e + 15, m = k.$(h).width() - l - 2, n = k.$(h).height() - e - 2; if (!isNaN(b) && !isNaN(a)) { b += o; a -= 30; b = Math.max(0, Math.min(m, b)); a = Math.max(0, Math.min(n, a)); if (g < f) a = f; c.css({ left: b, top: a }) } }, bind: function (f, i) { if (c.TOUCH) return; !F.initialized && F.init(); var g = function (f, i) { var g = "switch_tooltip"; F.define(f, i); a(f).hover(function () { b.clearTimer(g); k.$(h).unbind(A, F.move).bind(A, F.move).trigger(A); F.show(f); c.utils.addTimer(r, function () { k.$(r).stop().show().animate({ opacity: 1 }); F.open = d }, F.open ? 0 : 500) }, function () { k.$(h).unbind(A, F.move); b.clearTimer(r); k.$(r).stop().animate({ opacity: 0 }, H, function () { k.$(r).hide(); b.addTimer(g, function () { F.open = e }, 1e3) }) }) }; if (typeof i === R) g(f in k._dom ? k.get(f) : f, i); else a.each(f, function (a, b) { g(k.get(a), b) }) }, show: function (b) { b = a(b in k._dom ? k.get(b) : b); var c = b.data("tt"), d = function (a) { f.setTimeout(function (a) { return function () { F.move(a) } } (a), o); b.unbind(X, d) }; c = typeof c === n ? c() : c; if (!c) return; k.$(r).html(c.replace(/\s/, "&nbsp;")); b.bind(X, d) }, define: function (b, c) { if (typeof c !== n) { var d = c; c = function () { return d } } b = a(b in k._dom ? k.get(b) : b).data("tt", c); F.show(b) } }, K = D._fullscreen = { scrolled: 0, active: e, keymap: k._keyboard.map, enter: function (g) { K.active = d; b.hide(k.getActiveImage()); k.$(h).addClass(N); K.scrolled = x.scrollTop(); b.forceStyles(k.get(h), { position: "fixed", top: 0, left: 0, width: B, height: B, zIndex: 1e4 }); var i = { height: B, overflow: Y, margin: 0, padding: 0 }, e = k.getData(); b.forceStyles(y().html, i); b.forceStyles(y().body, i); K.keymap = a.extend({}, k._keyboard.map); k.attachKeyboard({ escape: k.exitFullscreen, right: k.next, left: k.prev }); if (e && e.big && e.image !== e.big) { var m = new c.Picture, j = m.isCached(e.big), f = k.getIndex(), l = k._thumbnails[f]; k.trigger({ type: c.LOADSTART, cached: j, index: f, imageTarget: k.getActiveImage(), thumbTarget: l }); m.load(e.big, function (b) { k._scaleImage(b, { complete: function (b) { k.trigger({ type: c.LOADFINISH, cached: j, index: f, imageTarget: b.image, thumbTarget: l }); var d = k._controls.getActive().image; d && a(d).width(b.image.width).height(b.image.height).attr(q, a(b.image).attr(q)).attr(C, b.image.src) } }) }) } k.rescale(function () { b.addTimer("fullscreen_enter", function () { b.show(k.getActiveImage()); typeof g === n && g.call(k) }, G); k.trigger(c.FULLSCREEN_ENTER) }); x.resize(function () { K.scale() }) }, scale: function () { k.rescale() }, exit: function (a) { K.active = e; b.hide(k.getActiveImage()); k.$(h).removeClass(N); b.revertStyles(k.get(h), y().html, y().body); f.scrollTo(0, K.scrolled); k.detachKeyboard(); k.attachKeyboard(K.keymap); k.rescale(function () { b.addTimer("fullscreen_exit", function () { b.show(k.getActiveImage()); typeof a === n && a.call(k) }, 50); k.trigger(c.FULLSCREEN_EXIT) }); x.unbind(M, K.scale) } }, I = D._idle = { trunk: [], bound: e, add: function (b, f) { if (!b) return; !I.bound && I.addEvent(); b = a(b); var g = {}, c; for (c in f) if (f.hasOwnProperty(c)) g[c] = b.css(c); b.data(J, { from: g, to: f, complete: d, busy: e }); I.addTimer(); I.trunk.push(b) }, remove: function (c) { c = jQuery(c); a.each(I.trunk, function (b, a) { if (a.length && !a.not(c).length) { k._idle.show(c); k._idle.trunk.splice(b, 1) } }); if (!I.trunk.length) { I.removeEvent(); b.clearTimer(J) } }, addEvent: function () { I.bound = d; k.$(h).bind(O, I.showAll) }, removeEvent: function () { I.bound = e; k.$(h).unbind(O, I.showAll) }, addTimer: function () { b.addTimer(J, function () { k._idle.hide() }, k._options.idleTime) }, hide: function () { if (!k._options.idleMode) return; k.trigger(c.IDLE_ENTER); a.each(I.trunk, function (d, a) { var c = a.data(J); if (!c) return; a.data(J).complete = e; b.animate(a, c.to, { duration: k._options.idleSpeed }) }) }, showAll: function () { b.clearTimer(J); a.each(k._idle.trunk, function (b, a) { k._idle.show(a) }) }, show: function (g) { var f = g.data(J); if (!f.busy && !f.complete) { f.busy = d; k.trigger(c.IDLE_EXIT); b.clearTimer(J); b.animate(g, f.from, { duration: k._options.idleSpeed / 2, complete: function () { a(this).data(J).busy = e; a(this).data(J).complete = d } }) } I.addTimer() } }, u = D._lightbox = { width: 0, height: 0, initialized: e, active: g, image: g, elems: {}, keymap: e, init: function () { var n = "background:#000;filter:alpha(opacity=0);", g = "lightbox-"; k.trigger(c.LIGHTBOX_OPEN); if (u.initialized) return; u.initialized = d; var q = "overlay box content shadow title info close prevholder prev nextholder next counter image", f = {}, m = k._options, p = j, e = "position:absolute;", i = g, h = { overlay: "position:fixed;display:none;opacity:" + m.overlayOpacity + ";filter:alpha(opacity=" + m.overlayOpacity * G + ");top:0;left:0;width:100%;height:100%;background:" + m.overlayBackground + ";z-index:99990", box: "position:fixed;display:none;width:400px;height:400px;top:50%;left:50%;margin-top:-200px;margin-left:-200px;z-index:99991", shadow: e + "background:#000;width:100%;height:100%;", content: e + "background-color:#fff;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden", info: e + "bottom:10px;left:10px;right:10px;color:#444;font:11px/13px arial,sans-serif;height:13px", close: e + "top:10px;right:10px;height:20px;width:20px;background:#fff;text-align:center;cursor:pointer;color:#444;font:16px/22px arial,sans-serif;z-index:99999", image: e + "top:10px;left:10px;right:10px;bottom:30px;overflow:hidden;display:block;", prevholder: e + "width:50%;top:0;bottom:40px;cursor:pointer;", nextholder: e + "width:50%;top:0;bottom:40px;right:-1px;cursor:pointer;", prev: e + "top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;left:20px;display:none;text-align:center;color:#000;font:bold 16px/36px arial,sans-serif", next: e + "top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;right:20px;left:auto;display:none;font:bold 16px/36px arial,sans-serif;text-align:center;color:#000", title: "float:left", counter: "float:right;margin-left:8px;" }, r = function (b) { return b.hover(function () { a(this).css("color", "#bbb") }, function () { a(this).css("color", "#444") }) }, o = {}; if (l === 8) { h.nextholder += n; h.prevholder += n } a.each(h, function (b, a) { p += ".galleria-" + i + b + "{" + a + "}" }); b.insertStyleTag(p); a.each(q.split(s), function (b, a) { k.addElement(g + a); f[a] = u.elems[a] = k.get(g + a) }); u.image = new c.Picture; a.each({ box: "shadow content close prevholder nextholder", info: "title counter", content: "info image", prevholder: Z, nextholder: ab }, function (c, d) { var b = []; a.each(d.split(s), function (c, a) { b.push(i + a) }); o[i + c] = b }); k.append(o); a(f.image).append(u.image.container); a(y().body).append(f.overlay, f.box); b.optimizeTouch(f.box); r(a(f.close).bind(v, u.hide).html("&#215;")); a.each(["Prev", "Next"], function (g, b) { var d = a(f[b.toLowerCase()]).html(/v/.test(b) ? "&#8249;&nbsp;" : "&nbsp;&#8250;"), e = a(f[b.toLowerCase() + "holder"]); e.bind(v, function () { u[bb + b]() }); if (l < 8 || c.TOUCH) { d.show(); return } e.hover(function () { d.show() }, function () { d.stop().fadeOut(H) }) }); a(f.overlay).bind(v, u.hide); if (c.IPAD) k._options.lightboxTransitionSpeed = 0 }, rescale: function (i) { var j = Math.min(x.width() - 40, u.width), h = Math.min(x.height() - 60, u.height), f = Math.min(j / u.width, h / u.height), e = Math.round(u.width * f) + 40, d = Math.round(u.height * f) + 60, g = { width: e, height: d, "margin-top": Math.ceil(d / 2) * -1, "margin-left": Math.ceil(e / 2) * -1 }; if (i) a(u.elems.box).css(g); else a(u.elems.box).animate(g, { duration: k._options.lightboxTransitionSpeed, easing: k._options.easing, complete: function () { var d = u.image, e = k._options.lightboxFadeSpeed; k.trigger({ type: c.LIGHTBOX_IMAGE, imageTarget: d.image }); a(d.container).show(); b.show(d.image, e); b.show(u.elems.info, e) } }) }, hide: function () { u.image.image = g; x.unbind(M, u.rescale); a(u.elems.box).hide(); b.hide(u.elems.info); k.detachKeyboard(); k.attachKeyboard(u.keymap); u.keymap = e; b.hide(u.elems.overlay, H, function () { a(this).hide().css(m, k._options.overlayOpacity); k.trigger(c.LIGHTBOX_CLOSE) }) }, showNext: function () { u.show(k.getNext(u.active)) }, showPrev: function () { u.show(k.getPrev(u.active)) }, show: function (c) { u.active = c = typeof c === t ? c : k.getIndex(); !u.initialized && u.init(); if (!u.keymap) { u.keymap = a.extend({}, k._keyboard.map); k.attachKeyboard({ escape: u.hide, right: u.showNext, left: u.showPrev }) } x.unbind(M, u.rescale); var d = k.getData(c), e = k.getDataLength(); b.hide(u.elems.info); u.image.load(d.big || d.image, function (f) { u.width = f.original.width; u.height = f.original.height; a(f.image).css({ width: "100.5%", height: "100.5%", top: 0, zIndex: 99998 }); b.hide(f.image); u.elems.title.innerHTML = d.title || j; u.elems.counter.innerHTML = c + 1 + " / " + e; x.resize(u.rescale); u.rescale() }); a(u.elems.overlay).show(); a(u.elems.box).show() } }; return D }; c.prototype = { constructor: c, init: function (j, h) { var f = this, k = f; h = ib(h); f._original = { target: j, options: h, data: g }; f._target = f._dom.target = j.nodeName ? j : a(j).get(0); O.push(f); if (!f._target) { c.raise("Target not found.", d); return } f._options = { autoplay: e, carousel: d, carouselFollow: d, carouselSpeed: 400, carouselSteps: z, clicknext: e, dataConfig: function () { return {} }, dataSelector: "img", dataSource: f._target, debug: i, easing: "galleria", extend: function () { }, fullscreenDoubleTap: d, height: z, idleMode: d, idleTime: 3e3, idleSpeed: H, imageCrop: e, imageMargin: 0, imagePan: e, imagePanSmoothness: 12, imagePosition: S, initialTransition: i, keepSource: e, lightbox: e, lightboxFadeSpeed: H, lightboxTransitionSpeed: H, linkSourceTmages: d, maxScaleRatio: i, minScaleRatio: i, overlayOpacity: .85, overlayBackground: "#0b0b0b", pauseOnInteraction: d, popupLinks: e, preload: 2, protect: e, queue: d, show: 0, showInfo: d, showCounter: d, showImagenav: d, swipe: d, thumbCrop: d, thumbEventType: v, thumbFit: d, thumbMargin: 0, thumbQuality: z, thumbnails: d, transition: "fade", transitionInitial: i, transitionSpeed: 400, useCanvas: e, width: z }; f._options.initialTransition = f._options.initialTransition || f._options.transitionInitial; if (h && h.debug === e) hb = e; a(f._target).children().hide(); if (typeof c.theme === E) f._init(); else b.wait({ until: function () { return typeof c.theme === E }, success: function () { k._init.call(k) }, error: function () { c.raise("No theme found.", d) }, timeout: 5e3 }) }, _init: function () { var s = "touchend", q = "image-nav", n = "images", i = this, m = i; if (i._initialized) { c.raise("Init failed: Gallery instance already initialized."); return i } i._initialized = d; if (!c.theme) { c.raise("Init failed: No theme found."); return i } a.extend(d, i._options, c.theme.defaults, i._original.options); (function (a) { if (!("getContext" in a)) { a = g; return } u = u || { elem: a, context: a.getContext("2d"), cache: {}, length: 0} })(k.createElement("canvas")); i.bind(c.DATA, function () { var g = this; g._original.data = g._data; g.get(cb).innerHTML = g.getDataLength(); var i = g.$(h), e = { width: 0, height: 0 }, j = function () { return m.$(p).height() }; b.wait({ until: function () { a.each([K, L], function (c, a) { if (m._options[a] && typeof m._options[a] === t) e[a] = m._options[a]; else e[a] = Math.max(b.parseValue(i.css(a)), b.parseValue(m.$(M).css(a)), i[a](), m.$(M)[a]()); i[a](e[a]) }); return j() && e.width && e.height > o }, success: function () { if (c.WEBKIT) f.setTimeout(function () { m._run() }, 1); else m._run() }, error: function () { if (j()) c.raise("Could not extract sufficient width/height of the gallery container. Traced measures: width:" + e.width + mb + e.height + "px.", d); else c.raise("Could not extract a stage height from the CSS. Traced height: " + j() + "px.", d) }, timeout: 2e3 }) }); i.append({ "info-text": ["info-title", "info-description"], info: ["info-text"], "image-nav": ["image-nav-right", "image-nav-left"], stage: [n, "loader", I, q], "thumbnails-list": [w], "thumbnails-container": [kb, W, jb], container: [p, lb, "info", r] }); b.hide(i.$(I).append(i.get("current"), " / ", i.get(cb))); i.setCounter("&#8211;"); b.hide(m.get(r)); i.$(h).addClass(c.TOUCH ? "touch" : "notouch"); a.each(new Array(2), function (d) { var b = new c.Picture; a(b.container).css({ position: T, top: 0, left: 0 }); m.$(n).append(b.container); m._controls[d] = b }); i.$(n).css({ position: N, top: 0, left: 0, width: B, height: B }); i.$("thumbnails, thumbnails-list").css({ overflow: Y, position: N }); i.$("image-nav-right, image-nav-left").bind(v, function (b) { m._options.clicknext && b.stopPropagation(); m._options.pauseOnInteraction && m.pause(); var a = /right/.test(this.className) ? ab : Z; m[a]() }); a.each(["info", I, q], function (c, a) { m._options[bb + a.substr(0, 1).toUpperCase() + a.substr(1).replace(/-/, j)] === e && b.moveOut(m.get(a.toLowerCase())) }); i.load(); if (!i._options.keep_source && !l) i._target.innerHTML = j; i.$(M).append(i.get(h)); i._options.carousel && i.bind(c.THUMBNAIL, function () { this.updateCarousel() }); if (i._options.swipe) { (function (g) { var a = [0, 0], c = [0, 0], n = 30, p = G, h = e, k = 0, d, f = { start: U, move: "touchmove", stop: s }, j = function (a) { return a.originalEvent.touches ? a.originalEvent.touches[0] : a }, i = function (b) { if (b.originalEvent.touches && b.originalEvent.touches.length > 1) return; d = j(b); c = [d.pageX, d.pageY]; if (!a[0]) a = c; Math.abs(a[0] - c[0]) > o && b.preventDefault() }, l = function (d) { g.unbind(f.move, i); if (d.originalEvent.touches && d.originalEvent.touches.length || h) { h = !h; return } if (b.timestamp() - k < 1e3 && Math.abs(a[0] - c[0]) > n && Math.abs(a[1] - c[1]) < p) { d.preventDefault(); m[a[0] > c[0] ? ab : Z]() } a = c = [0, 0] }; g.bind(f.start, function (e) { if (e.originalEvent.touches && e.originalEvent.touches.length > 1) return; d = j(e); k = b.timestamp(); a = c = [d.pageX, d.pageY]; g.bind(f.move, i).one(f.stop, l) }) })(m.$(n)); i._options.fullscreenDoubleTap && i.$(p).bind(U, function () { var f, b, d, g, h, a, e = function (a) { return a.originalEvent.touches ? a.originalEvent.touches[0] : a }; return function (i) { a = c.utils.timestamp(); b = e(i).pageX; d = e(i).pageY; if (a - f < 500 && b - g < 20 && d - h < 20) { m.toggleFullscreen(); i.preventDefault(); m.$(p).unbind(s, arguments.callee); return } f = a; g = b; h = d } } ()) } b.optimizeTouch(i.get(h)); return i }, _createThumbnails: function () { var j = this; j.get(cb).innerHTML = j.getDataLength(); var l, q, h, n, o, m = j, i = j._options, u = function () { var a = m.$(w).find(".active"); return !a.length ? e : a.find("img").attr(C) } (), p = typeof i.thumbnails === R ? i.thumbnails.toLowerCase() : g, r = function (a) { return k.defaultView && k.defaultView.getComputedStyle ? k.defaultView.getComputedStyle(h.container, g)[a] : o.css(a) }, v = function (b, e, d) { return function () { a(d).append(b); m.trigger({ type: c.THUMBNAIL, thumbTarget: b, index: e }) } }, s = function (c) { i.pauseOnInteraction && m.pause(); var b = a(c.currentTarget).data("index"); m.getIndex() !== b && m.show(b); c.preventDefault() }, t = function (e) { e.scale({ width: e.data.width, height: e.data.height, crop: i.thumbCrop, margin: i.thumbMargin, canvas: i.useCanvas, complete: function (e) { var j = [P, Q], h = ["Width", "Height"], g, f; a.each(h, function (c, b) { g = b.toLowerCase(); if ((i.thumbCrop !== d || i.thumbCrop === g) && i.thumbFit) { f = {}; f[g] = e[g]; a(e.container).css(f); f = {}; f[j[c]] = 0; a(e.image).css(f) } e["outer" + b] = a(e.container)["outer" + b](d) }); b.toggleQuality(e.image, i.thumbQuality === d || i.thumbQuality === z && e.original.width < e.width * 3); m.trigger({ type: c.THUMBNAIL, thumbTarget: e.image, index: e.data.order }) } }) }; j._thumbnails = []; j.$(w).empty(); for (l = 0; j._data[l]; l++) { n = j._data[l]; if (i.thumbnails === d) { h = new c.Picture(l); q = n.thumb || n.image; j.$(w).append(h.container); o = a(h.container); h.data = { width: b.parseValue(r(K)), height: b.parseValue(r(L)), order: l }; if (i.thumbFit && i.thumbCrop !== d) o.css({ width: 0, height: 0 }); else o.css({ width: h.data.width, height: h.data.height }); h.load(q, t); i.preload === "all" && h.add(n.image) } else if (p === "empty" || p === "numbers") { h = { container: b.create(nb), image: b.create("img", "span"), ready: d }; p === "numbers" && a(h.image).text(l + 1); j.$(w).append(h.container); f.setTimeout(v(h.image, l, h.container), 50 + l * 20) } else h = { container: g, image: g }; a(h.container).add(i.keepSource && i.linkSourceImages ? n.original : g).data("index", l).bind(i.thumbEventType, s); u === q && a(h.container).addClass(db); j._thumbnails.push(h) } }, _run: function () { var e = this; e._createThumbnails(); b.wait({ until: function () { c.OPERA && e.$(p).css("display", "inline-block"); e._stageWidth = e.$(p).width(); e._stageHeight = e.$(p).height(); return e._stageWidth && e._stageHeight > 50 }, success: function () { gb.push(e); b.show(e.get(I)); e._options.carousel && e._carousel.bindControls(); if (e._options.autoplay) { e.pause(); if (typeof e._options.autoplay === t) e._playtime = e._options.autoplay; e.trigger(c.PLAY); e._playing = d } if (e._firstrun) { typeof e._options.show === t && e.show(e._options.show); return } e._firstrun = d; if (e._options.clicknext && !c.TOUCH) { a.each(e._data, function (b, a) { delete a.link }); e.$(p).css({ cursor: "pointer" }).bind(v, function () { e._options.pauseOnInteraction && e.pause(); e.next() }) } c.History && c.History.change(function (b) { var a = parseInt(b.value.replace(/\//, j), o); if (isNaN(a)) f.history.go(-1); else e.show(a, i, d) }); a.each(c.ready.callbacks, function () { this.call(e, e._options) }); e.trigger(c.READY); c.theme.init.call(e, e._options); e._options.extend.call(e, e._options); if (/^[0-9]{1,4}$/.test(rb) && c.History) e.show(rb, i, d); else e._data[e._options.show] && e.show(e._options.show) }, error: function () { c.raise("Stage width or height is too small to show the gallery. Traced measures: width:" + e._stageWidth + mb + e._stageHeight + "px.", d) } }) }, load: function (d, e, f) { var b = this, h = b; b._data = []; b._thumbnails = []; b.$(w).empty(); if (typeof e === n) { f = e; e = g } d = d || b._options.dataSource; e = e || b._options.dataSelector; f = f || b._options.dataConfig; if (/^function Object/.test(d.constructor)) d = [d]; if (d.constructor === Array) { if (b.validate(d)) { b._data = d; b._parseData().trigger(c.DATA) } else c.raise("Load failed: JSON Array not valid."); return b } a(d).find(e).each(function (k, b) { b = a(b); var c = {}, e = b.parent(), d = e.attr("href"), i = e.attr("rel"), g = /\.(png|gif|jpg|jpeg)(\?.*)?$/i; if (g.test(d)) { c.image = d; if (g.test(i)) c.big = i; else c.big = d } else if (d) c.link = d; h._data.push(a.extend({ title: b.attr("title") || j, thumb: b.attr(C), image: b.attr(C), big: b.attr(C), description: b.attr("alt") || j, link: b.attr("longdesc"), original: b.get(0) }, c, f(b))) }); if (b.getDataLength()) b.trigger(c.DATA); else c.raise("Load failed: no data found."); return b }, _parseData: function () { var b = this; a.each(this._data, function (c, a) { if ("thumb" in a === e) b._data[c].thumb = a.image; if (false in a) b._data[c].big = a.image }); return this }, splice: function () { Array.prototype.splice.apply(this._data, b.array(arguments)); return this._parseData()._createThumbnails() }, push: function () { Array.prototype.push.apply(this._data, b.array(arguments)); return this._parseData()._createThumbnails() }, _getActive: function () { return this._controls.getActive() }, validate: function () { return d }, bind: function (a, b) { a = fb(a); this.$(h).bind(a, this.proxy(b)); return this }, unbind: function (a) { a = fb(a); this.$(h).unbind(a); return this }, trigger: function (b) { var c = this; b = typeof b === E ? a.extend(b, { scope: c }) : { type: fb(b), scope: c }; c.$(h).trigger(b); return c }, addIdleState: function () { this._idle.add.apply(this._idle, b.array(arguments)); return this }, removeIdleState: function () { this._idle.remove.apply(this._idle, b.array(arguments)); return this }, enterIdleMode: function () { this._idle.hide(); return this }, exitIdleMode: function () { this._idle.showAll(); return this }, enterFullscreen: function () { this._fullscreen.enter.apply(this, b.array(arguments)); return this }, exitFullscreen: function () { this._fullscreen.exit.apply(this, b.array(arguments)); return this }, toggleFullscreen: function () { var a = this; a._fullscreen[a.isFullscreen() ? "exit" : "enter"].apply(a, b.array(arguments)); return a }, bindTooltip: function () { this._tooltip.bind.apply(this._tooltip, b.array(arguments)); return this }, defineTooltip: function () { this._tooltip.define.apply(this._tooltip, b.array(arguments)); return this }, refreshTooltip: function () { this._tooltip.show.apply(this._tooltip, b.array(arguments)); return this }, openLightbox: function () { this._lightbox.show.apply(this._lightbox, b.array(arguments)); return this }, closeLightbox: function () { this._lightbox.hide.apply(this._lightbox, b.array(arguments)); return this }, getActiveImage: function () { return this._getActive().image || i }, getActiveThumb: function () { return this._thumbnails[this._active].image || i }, getMousePosition: function (a) { return { x: a.pageX - this.$(h).offset().left, y: a.pageY - this.$(h).offset().top} }, addPan: function (c) { var g = this; if (g._options.imageCrop === e) return; c = a(c || g.getActiveImage()); var f = g, v = c.width() / 2, w = c.height() / 2, k = parseInt(c.css(P), o), m = parseInt(c.css(Q), o), i = k || 0, j = m || 0, n = 0, q = 0, t = e, y = b.timestamp(), u = 0, h = 0, s = function (a, e, d) { if (a > 0) { h = Math.round(Math.max(a * -1, Math.min(0, e))); if (u !== h) { u = h; if (l === 8) c.parent()["scroll" + d](h * -1); else { var b = {}; b[d.toLowerCase()] = h; c.css(b) } } } }, r = function (a) { if (b.timestamp() - y < 50) return; t = d; v = f.getMousePosition(a).x; w = f.getMousePosition(a).y }, x = function () { if (!t) return; n = c.width() - f._stageWidth; q = c.height() - f._stageHeight; k = v / f._stageWidth * n * -1; m = w / f._stageHeight * q * -1; i += (k - i) / f._options.imagePanSmoothness; j += (m - j) / f._options.imagePanSmoothness; s(q, j, "Top"); s(n, i, "Left") }; if (l === 8) { c.parent().scrollTop(j * -1).scrollLeft(i * -1); c.css({ top: 0, left: 0 }) } g.$(p).unbind(A, r).bind(A, r); b.addTimer("pan", x, 50, d); return g }, proxy: function (c, a) { if (typeof c !== n) return function () { }; a = a || this; return function () { return c.apply(a, b.array(arguments)) } }, removePan: function () { this.$(p).unbind(A); b.clearTimer("pan"); return this }, addElement: function () { var c = this._dom; a.each(b.array(arguments), function (d, a) { c[a] = b.create(V + a) }); return this }, attachKeyboard: function () { this._keyboard.attach.apply(this._keyboard, b.array(arguments)); return this }, detachKeyboard: function () { this._keyboard.detach.apply(this._keyboard, b.array(arguments)); return this }, appendChild: function (b, a) { this.$(b).append(this.get(a) || a); return this }, prependChild: function (b, a) { this.$(b).prepend(this.get(a) || a); return this }, remove: function () { this.$(b.array(arguments).join(",")).remove(); return this }, append: function (b) { var a, c; for (a in b) if (b.hasOwnProperty(a)) if (b[a].constructor === Array) for (c = 0; b[a][c]; c++) this.appendChild(a, b[a][c]); else this.appendChild(a, b[a]); return this }, _scaleImage: function (d, c) { var b = this; c = a.extend({ width: b._stageWidth, height: b._stageHeight, crop: b._options.imageCrop, max: b._options.maxScaleRatio, min: b._options.minScaleRatio, margin: b._options.imageMargin, position: b._options.imagePosition }, c); (d || b._controls.getActive()).scale(c); return b }, updateCarousel: function () { this._carousel.update(); return this }, rescale: function (d, f, e) { var a = this; if (typeof d === n) { e = d; d = i } var g = function () { a._stageWidth = d || a.$(p).width(); a._stageHeight = f || a.$(p).height(); a._scaleImage(); a._options.carousel && a.updateCarousel(); a.trigger(c.RESCALE); typeof e === n && e.call(a) }; if (c.WEBKIT && !d && !f) b.addTimer("scale", g, o); else g.call(a); return this }, refreshImage: function () { var a = this; a._scaleImage(); a._options.imagePan && a.addPan(); return a }, show: function (b, d, f) { var a = this; if (b === e || !a._options.queue && a._queue.stalled) return; b = Math.max(0, Math.min(parseInt(b, o), a.getDataLength() - 1)); d = typeof d !== F ? !!d : b < a.getIndex(); f = f || e; if (!f && c.History) { c.History.value(b.toString()); return } a._active = b; Array.prototype.push.call(a._queue, { index: b, rewind: d }); !a._queue.stalled && a._show(); return a }, _show: function () { var j = this, h = j, k = j._queue[0], m = j.getData(k.index); if (!m) return; var u = j.isFullscreen() && "big" in m ? m.big : m.image, l = j._controls.getActive(), n = j._controls.getNext(), s = n.isCached(u), t = j._thumbnails[k.index], r = function (g, d, i, j, k) { return function () { var l; h._queue.stalled = e; b.toggleQuality(d.image, h._options.imageQuality); a(i.container).css({ zIndex: 0, opacity: 0 }).show(); a(d.container).css({ zIndex: 1, opacity: 1 }).show(); h._controls.swap(); h._options.imagePan && h.addPan(d.image); (g.link || h._options.lightbox) && a(d.image).css({ cursor: "pointer" }).bind(X, function () { if (g.link) { if (h._options.popupLinks) l = f.open(g.link, "_blank"); else f.location.href = g.link; return } h.openLightbox() }); Array.prototype.shift.call(h._queue); h._queue.length && h._show(); h._playCheck(); h.trigger({ type: c.IMAGE, index: j.index, imageTarget: d.image, thumbTarget: k.image }) } } (m, n, l, k, t); j._options.carousel && j._options.carouselFollow && j._carousel.follow(k.index); if (j._options.preload) { var v, p, q = j.getNext(), o; try { for (p = j._options.preload; p > 0; p--) { v = new c.Picture; o = h.getData(q); v.add(j.isFullscreen() && "big" in o ? o.big : o.image); q = h.getNext(q) } } catch (w) { } } b.show(n.container); a(h._thumbnails[k.index].container).addClass(db).siblings(".active").removeClass(db); h.trigger({ type: c.LOADSTART, cached: s, index: k.index, imageTarget: n.image, thumbTarget: t.image }); n.load(u, function (a) { h._scaleImage(a, { complete: function (a) { "image" in l && b.toggleQuality(l.image, e); b.toggleQuality(a.image, e); h._queue.stalled = d; h.removePan(); h.setInfo(k.index); h.setCounter(k.index); h.trigger({ type: c.LOADFINISH, cached: s, index: k.index, imageTarget: a.image, thumbTarget: h._thumbnails[k.index].image }); var f = l.image === g && h._options.initialTransition !== i ? h._options.initialTransition : h._options.transition; if (f in eb === e) r(); else { var j = { prev: l.container, next: a.container, rewind: k.rewind, speed: h._options.transitionSpeed || 400 }; eb[f].call(h, j, r) } } }) }) }, getNext: function (a) { a = typeof a === t ? a : this.getIndex(); return a === this.getDataLength() - 1 ? 0 : a + 1 }, getPrev: function (a) { a = typeof a === t ? a : this.getIndex(); return a === 0 ? this.getDataLength() - 1 : a - 1 }, next: function () { var a = this; a.getDataLength() > 1 && a.show(a.getNext(), e); return a }, prev: function () { var a = this; a.getDataLength() > 1 && a.show(a.getPrev(), d); return a }, "get": function (a) { return a in this._dom ? this._dom[a] : g }, getData: function (b) { var a = this; return b in a._data ? a._data[b] : a._data[a._active] }, getDataLength: function () { return this._data.length }, getIndex: function () { return typeof this._active === t ? this._active : e }, getStageHeight: function () { return this._stageHeight }, getStageWidth: function () { return this._stageWidth }, getOptions: function (a) { return typeof a === F ? this._options : this._options[a] }, setOptions: function (b, c) { if (typeof b === E) a.extend(this._options, b); else this._options[b] = c; return this }, play: function (b) { var a = this; a._playing = d; a._playtime = b || a._playtime; a._playCheck(); a.trigger(c.PLAY); return a }, pause: function () { this._playing = e; this.trigger(c.PAUSE); return this }, playToggle: function (a) { return this._playing ? this.pause() : this.play(a) }, isPlaying: function () { return this._playing }, isFullscreen: function () { return this._fullscreen.active }, _playCheck: function () { var a = this, d = 0, f = 20, h = b.timestamp(), e = "play" + this._id; if (this._playing) { b.clearTimer(e); var g = function () { d = b.timestamp() - h; if (d >= a._playtime && a._playing) { b.clearTimer(e); a.next(); return } if (a._playing) { a.trigger({ type: c.PROGRESS, percent: Math.ceil(d / a._playtime * G), seconds: Math.floor(d / 1e3), milliseconds: d }); b.addTimer(e, g, f) } }; b.addTimer(e, g, f) } }, setIndex: function (a) { this._active = a; return this }, setCounter: function (b) { var a = this; if (typeof b === t) b++; else if (typeof b === F) b = a.getIndex() + 1; a.get("current").innerHTML = b; if (l) { var c = a.$(I), d = c.css(m), e = c.attr(q); if (e && parseInt(d, o) === 1) c.attr(q, e.replace(/filter[^\;]+\;/i, j)); else a.$(I).css(m, d) } return a }, setInfo: function (c) { var d = this, b = this.getData(c); a.each(["title", "description"], function (e, a) { var c = d.$("info-" + a); if (!!b[a]) c[b[a].length ? bb : "hide"]().html(b[a]); else c.empty().hide() }); return this }, hasInfo: function (c) { for (var b = "title description".split(s), a = 0; b[a]; a++) if (!!this.getData(c)[b[a]]) return d; return e }, jQuery: function (e) { var b = this, c = []; a.each(e.split(","), function (e, d) { d = a.trim(d); b.get(d) && c.push(d) }); var d = a(b.get(c.shift())); a.each(c, function (c, a) { d = d.add(b.get(a)) }); return d }, $: function () { return this.jQuery.apply(this, b.array(arguments)) } }; a.each(pb, function (d, a) { var b = /_/.test(a) ? a.replace(/_/g, j) : a; c[a.toUpperCase()] = "galleria." + b }); a.extend(c, { IE9: l === 9, IE8: l === 8, IE7: l === 7, IE6: l === 6, IE: !!l, WEBKIT: /webkit/.test(J), SAFARI: /safari/.test(J), CHROME: /chrome/.test(J), QUIRK: l && k.compatMode && k.compatMode === "BackCompat", MAC: /mac/.test(navigator.platform.toLowerCase()), OPERA: !!f.opera, IPHONE: /iphone/.test(J), IPAD: /ipad/.test(J), ANDROID: /android/.test(J), TOUCH: "ontouchstart" in document }); c.addTheme = function (f) { !f.name && c.raise("No theme name specified"); if (typeof f.defaults !== E) f.defaults = {}; else f.defaults = ib(f.defaults); var g = e, h; if (typeof f.css === R) { a("link").each(function (b, a) { h = new RegExp(f.css); if (h.test(a.href)) { g = d; c.theme = f; return e } }); !g && a("script").each(function (d, a) { h = new RegExp("galleria\\." + f.name.toLowerCase() + "\\."); if (h.test(a.src)) { g = a.src.replace(/[^\/]*$/, j) + f.css; b.addTimer("css", function () { b.loadCSS(g, "galleria-theme", function () { c.theme = f }) }, 1) } }); !g && c.raise("No theme CSS loaded") } else c.theme = f; return f }; c.loadTheme = function (g, j) { var f = e, k = gb.length; c.theme = i; b.loadScript(g, function () { f = d }); b.wait({ until: function () { return f }, error: function () { c.raise("Theme at " + g + " could not load, check theme path.", d) }, success: function () { if (k) { var b = []; a.each(c.get(), function (g, d) { var f = a.extend(d._original.options, { data_source: d._data }, j); d.$(h).remove(); var e = new c; e._id = d._id; e.init(d._original.target, f); b.push(e) }); gb = b } }, timeout: 2e3 }) }; c.get = function (a) { if (!!O[a]) return O[a]; else if (typeof a !== t) return O; else c.raise("Gallery index " + a + " not found") }; c.addTransition = function (a, b) { eb[a] = b }; c.utils = b; c.log = function () { try { f.console.log.apply(f.console, b.array(arguments)) } catch (c) { try { f.opera.postError.apply(f.opera, arguments) } catch (a) { f.alert(b.array(arguments).split(", ")) } } }; c.ready = function (a) { c.ready.callbacks.push(a) }; c.ready.callbacks = []; c.raise = function (g, b) { var f = b ? "Fatal error" : "Error", h = this, c = function (d) { var c = '<div style="padding:4px;margin:0 0 2px;background:#' + (b ? "811" : "222") + '";>' + (b ? "<strong>" + f + ": </strong>" : j) + d + "</div>"; a.each(O, function () { var a = "errors", b = this.$(a), d = this.$(M); if (!b.length) { d.css("position", N); b = this.addElement(a).appendChild(M, a).$(a).css({ color: "#fff", position: T, top: 0, left: 0, zIndex: 1e5 }) } b.append(c) }) }; if (hb) { c(g); if (b) throw new Error(f + ": " + g); } else if (b) { if (ob) return; ob = d; b = e; c("Image gallery could not load.") } }; c.Picture = function (d) { var c = this; c.id = d || g; c.image = g; c.container = b.create(nb); a(c.container).css({ overflow: Y, position: N }); c.original = { width: 0, height: 0 }; c.ready = e; c.loaded = e }; c.Picture.prototype = { cache: {}, add: function (e) { var h = 0, f = this, b = new Image, g = function () { var c = this; if ((!c.width || !c.height) && h < 1e3) { h++; a(b).load(g).attr(C, e + "?" + +new Date) } f.original = { height: c.height, width: c.width }; f.cache[e] = e; f.loaded = d }; a(b).css("display", "block"); if (f.cache[e]) { b.src = e; g.call(b); return b } a(b).load(g).error(function () { c.raise("image could not load: " + e) }).attr(C, e); return b }, show: function () { b.show(this.image) }, hide: function () { b.moveOut(this.image) }, clear: function () { this.image = g }, isCached: function (a) { return !!this.cache[a] }, load: function (i, h) { var e = this, g = e; a(e.container).empty(d); e.image = e.add(i); b.hide(e.image); a(e.container).append(e.image); b.wait({ until: function () { return g.loaded && g.image.complete && g.original.width && g.image.width }, success: function () { f.setTimeout(function () { h.call(g, g) }, 1) }, error: function () { f.setTimeout(function () { h.call(g, g) }, 1); c.raise("image not loaded in 30 seconds: " + i) }, timeout: 3e4 }); return e.container }, scale: function (g) { var m = this; g = a.extend({ width: 0, height: 0, min: i, max: i, margin: 0, complete: function () { }, position: "center", crop: e, canvas: e }, g); if (!m.image) return m.container; var k, h, f = m, l = a(f.container), n; b.wait({ until: function () { k = g.width || l.width() || b.parseValue(l.css(K)); h = g.height || l.height() || b.parseValue(l.css(L)); return k && h }, success: function () { var m = (k - g.margin * 2) / f.original.width, l = (h - g.margin * 2) / f.original.height, t = { "true": Math.max(m, l), width: m, height: l, "false": Math.min(m, l) }, e = t[g.crop.toString()], i = j; if (g.max) e = Math.min(g.max, e); if (g.min) e = Math.max(g.min, e); a.each([K, L], function (c, b) { a(f.image)[b](f[b] = f.image[b] = Math.round(f.original[b] * e)) }); a(f.container).width(k).height(h); if (g.canvas && u) { u.elem.width = f.width; u.elem.height = f.height; i = f.image.src + ":" + f.width + "x" + f.height; f.image.src = u.cache[i] || function (a) { u.context.drawImage(f.image, 0, 0, f.original.width * e, f.original.height * e); try { n = u.elem.toDataURL(); u.length += n.length; u.cache[a] = n; return n } catch (b) { return f.image.src } } (i) } var c = {}, p = {}, q = function (d, e, h) { var c = 0; if (/\%/.test(d)) { var g = parseInt(d, o) / G, i = f.image[e] || a(f.image)[e](); c = Math.ceil(i * -1 * g + h * g) } else c = b.parseValue(d); return c }, r = { top: { top: 0 }, left: { left: 0 }, right: { left: B }, bottom: { top: B} }; a.each(g.position.toLowerCase().split(s), function (b, a) { if (a === "center") a = S; c[b ? Q : P] = a }); a.each(c, function (c, b) { r.hasOwnProperty(b) && a.extend(p, r[b]) }); c = c.top ? a.extend(c, p) : p; c = a.extend({ top: S, left: S }, c); a(f.image).css({ position: N, top: q(c.top, L, h), left: q(c.left, K, k) }); f.show(); f.ready = d; g.complete.call(f, f) }, error: function () { c.raise("Could not scale image: " + f.image.src) }, timeout: 1e3 }); return m } }; a.extend(a.easing, { galleria: function (e, a, b, c, d) { return (a /= d / 2) < 1 ? c / 2 * a * a * a + b : c / 2 * ((a -= 2) * a * a + 2) + b }, galleriaIn: function (e, a, b, c, d) { return c * (a /= d) * a + b }, galleriaOut: function (e, a, b, c, d) { return -c * (a /= d) * (a - 2) + b } }); a.fn.galleria = function (a) { return this.each(function () { var b = new c; b.init(this, a) }) }; f.Galleria = c })(jQuery);
