!function (o) { var t = { callback: !1, target: !1, duration: 120, touch: !0, onZoomIn: !1, onZoomOut: !1 }; o.zoom = function (t, n, e, i) { var r, l, c, u, a, s, m, h = o(t), d = h.css("position"), f = o(n); return h.css("position", /(absolute|fixed)/.test(d) ? d : "relative"), h.css("overflow", "hidden"), e.style.width = e.style.height = "", o(e).addClass("zoomImg").attr("alt", "Image Zoom").css({ position: "absolute", top: 0, left: 0, opacity: 0, width: e.width * i, height: e.height * i, border: "none", maxWidth: "none", maxHeight: "none" }).appendTo(t), { init: function () { l = h.outerWidth(), r = h.outerHeight(), n === h[0] ? (u = l, c = r) : (u = f.outerWidth(), c = f.outerHeight()), a = (e.width - l) / u, s = (e.height - r) / c, m = f.offset() }, move: function (o) { var t = o.pageX - m.left, n = o.pageY - m.top; n = Math.max(Math.min(n, c), 0), t = Math.max(Math.min(t, u), 0), e.style.left = -(t * a) + "px", e.style.top = -(n * s) + "px" } } }, o.fn.zoom = function (n) { return this.each(function () { var e = o.extend({ borderStyle: null, borderWidth: null, borderColor: null, imgWidth: !1, magnify: !1, on: !1, url: !1, complete: null }, t, n || {}), i = e.target || this, r = this, l = o(r), c = (o(i), document.createElement("img")), u = o(c), a = "mousemove", s = !1, m = !1; e.borderStyle && o(this).css("border-style", e.borderStyle), e.borderWidth && o(this).css("border-width", e.borderWidth), e.borderColor && o(this).css("border-color", e.borderColor), e.imgWidth && o(this).css("width", e.imgWidth), e.magnify && e.magnify, e.on && e.on, e.url || ($urlElement = l.find("img"), e.url = $urlElement.data("large_image")), o.isFunction(e.complete) && e.complete.call(this), c.onload = function () { var t = o.zoom(i, r, c, e.magnify); function n(n) { t.init(), t.move(n), u.stop().fadeTo(o.support.opacity ? e.duration : 0, 1, !!o.isFunction(e.onZoomIn) && e.onZoomIn.call(c)) } function h() { u.stop().fadeTo(e.duration, 0, !!o.isFunction(e.onZoomOut) && e.onZoomOut.call(c)) } "grab" === e.on ? l.on("mousedown", function (e) { 1 === e.which && (o(document).one("mouseup", function () { h(), o(document).off(a, t.move) }), n(e), o(document).on(a, t.move), e.preventDefault()) }) : "click" === e.on ? l.on("click", function (e) { if (!s) return s = !0, n(e), o(document).on(a, t.move), o(document).one("click", function () { h(), s = !1, o(document).off(a, t.move) }), !1 }) : "toggle" === e.on ? l.on("click", function (o) { s ? h() : n(o), s = !s }) : "mouseover" === e.on && (t.init(), l.on("mouseenter", n).on("mouseleave", h).on(a, t.move)), e.touch && l.on("touchstart", function (o) { o.preventDefault(), m ? (m = !1, h()) : (m = !0, n(o.originalEvent.touches[0] || o.originalEvent.changedTouches[0])) }).on("touchmove", function (o) { o.preventDefault(), t.move(o.originalEvent.touches[0] || o.originalEvent.changedTouches[0]) }), o.isFunction(e.callback) && e.callback.call(c) }, c.src = e.url }) }, o.fn.zoom.defaults = t }(window.jQuery);