/*
 Galleria v 1.2.4 2011-06-07
 http://galleria.aino.se

 modified by bi Medien GmbH
 http://www.bi-medien.de

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