﻿(function(a) { var b = window.EYE = function() { var c = { init: [] }; return { init: function() { a.each(c.init, function(e, d) { d.call() }) }, extend: function(e) { for (var d in e) { if (e[d] != undefined) { this[d] = e[d] } } }, register: function(e, d) { if (!c[d]) { c[d] = [] } c[d].push(e) } } } (); a(b.init) })(jQuery); (function(a) { EYE.extend({ getPosition: function(f, b) { var j = 0; var h = 0; var k = f.style; var l = false; if (b && jQuery.curCSS(f, "display") == "none") { var g = k.visibility; var i = k.position; l = true; k.visibility = "hidden"; k.display = "block"; k.position = "absolute" } var c = f; if (c.getBoundingClientRect) { var d = c.getBoundingClientRect(); j = d.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; h = d.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2 } else { j = c.offsetLeft; h = c.offsetTop; c = c.offsetParent; if (f != c) { while (c) { j += c.offsetLeft; h += c.offsetTop; c = c.offsetParent } } if (jQuery.browser.safari && jQuery.curCSS(f, "position") == "absolute") { j -= document.body.offsetLeft; h -= document.body.offsetTop } c = f.parentNode; while (c && c.tagName.toUpperCase() != "BODY" && c.tagName.toUpperCase() != "HTML") { if (jQuery.curCSS(c, "display") != "inline") { j -= c.scrollLeft; h -= c.scrollTop } c = c.parentNode } } if (l == true) { k.display = "none"; k.position = i; k.visibility = g } return { x: j, y: h} }, getSize: function(i) { var b = parseInt(jQuery.curCSS(i, "width"), 10); var f = parseInt(jQuery.curCSS(i, "height"), 10); var g = 0; var k = 0; if (jQuery.curCSS(i, "display") != "none") { g = i.offsetWidth; k = i.offsetHeight } else { var j = i.style; var c = j.visibility; var d = j.position; j.visibility = "hidden"; j.display = "block"; j.position = "absolute"; g = i.offsetWidth; k = i.offsetHeight; j.display = "none"; j.position = d; j.visibility = c } return { w: b, h: f, wb: g, hb: k} }, getClient: function(d) { var c, b; if (d) { b = d.clientWidth; c = d.clientHeight } else { var f = document.documentElement; b = window.innerWidth || self.innerWidth || (f && f.clientWidth) || document.body.clientWidth; c = window.innerHeight || self.innerHeight || (f && f.clientHeight) || document.body.clientHeight } return { w: b, h: c} }, getScroll: function(j) { var f = 0, c = 0, b = 0, g = 0, d = 0, i = 0; if (j && j.nodeName.toLowerCase() != "body") { f = j.scrollTop; c = j.scrollLeft; b = j.scrollWidth; g = j.scrollHeight } else { if (document.documentElement) { f = document.documentElement.scrollTop; c = document.documentElement.scrollLeft; b = document.documentElement.scrollWidth; g = document.documentElement.scrollHeight } else { if (document.body) { f = document.body.scrollTop; c = document.body.scrollLeft; b = document.body.scrollWidth; g = document.body.scrollHeight } } if (typeof pageYOffset != "undefined") { f = pageYOffset; c = pageXOffset } d = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0; i = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0 } return { t: f, l: c, w: b, h: g, iw: d, ih: i} }, getMargins: function(i, f) { var g = jQuery.curCSS(i, "marginTop") || ""; var h = jQuery.curCSS(i, "marginRight") || ""; var c = jQuery.curCSS(i, "marginBottom") || ""; var d = jQuery.curCSS(i, "marginLeft") || ""; if (f) { return { t: parseInt(g, 10) || 0, r: parseInt(h, 10) || 0, b: parseInt(c, 10) || 0, l: parseInt(d, 10)} } else { return { t: g, r: h, b: c, l: d} } }, getPadding: function(i, f) { var g = jQuery.curCSS(i, "paddingTop") || ""; var h = jQuery.curCSS(i, "paddingRight") || ""; var c = jQuery.curCSS(i, "paddingBottom") || ""; var d = jQuery.curCSS(i, "paddingLeft") || ""; if (f) { return { t: parseInt(g, 10) || 0, r: parseInt(h, 10) || 0, b: parseInt(c, 10) || 0, l: parseInt(d, 10)} } else { return { t: g, r: h, b: c, l: d} } }, getBorder: function(i, f) { var g = jQuery.curCSS(i, "borderTopWidth") || ""; var h = jQuery.curCSS(i, "borderRightWidth") || ""; var c = jQuery.curCSS(i, "borderBottomWidth") || ""; var d = jQuery.curCSS(i, "borderLeftWidth") || ""; if (f) { return { t: parseInt(g, 10) || 0, r: parseInt(h, 10) || 0, b: parseInt(c, 10) || 0, l: parseInt(d, 10) || 0} } else { return { t: g, r: h, b: c, l: d} } }, traverseDOM: function(b, c) { c(b); b = b.firstChild; while (b) { EYE.traverseDOM(b, c); b = b.nextSibling } }, getInnerWidth: function(d, b) { var c = d.offsetWidth; return b ? Math.max(d.scrollWidth, c) - c + d.clientWidth : d.clientWidth }, getInnerHeight: function(d, b) { var c = d.offsetHeight; return b ? Math.max(d.scrollHeight, c) - c + d.clientHeight : d.clientHeight }, getExtraWidth: function(b) { if (a.boxModel) { return (parseInt(a.curCSS(b, "paddingLeft")) || 0) + (parseInt(a.curCSS(b, "paddingRight")) || 0) + (parseInt(a.curCSS(b, "borderLeftWidth")) || 0) + (parseInt(a.curCSS(b, "borderRightWidth")) || 0) } return 0 }, getExtraHeight: function(b) { if (a.boxModel) { return (parseInt(a.curCSS(b, "paddingTop")) || 0) + (parseInt(a.curCSS(b, "paddingBottom")) || 0) + (parseInt(a.curCSS(b, "borderTopWidth")) || 0) + (parseInt(a.curCSS(b, "borderBottomWidth")) || 0) } return 0 }, isChildOf: function(d, c, b) { if (d == c) { return true } if (!c || !c.nodeType || c.nodeType != 1) { return false } if (d.contains && !a.browser.safari) { return d.contains(c) } if (d.compareDocumentPosition) { return !!(d.compareDocumentPosition(c) & 16) } var e = c.parentNode; while (e && e != b) { if (e == d) { return true } e = e.parentNode } return false }, centerEl: function(e, d) { var b = EYE.getScroll(); var c = EYE.getSize(e); if (!d || d == "vertically") { a(e).css({ top: b.t + ((Math.min(b.h, b.ih) - c.hb) / 2) + "px" }) } if (!d || d == "horizontally") { a(e).css({ left: b.l + ((Math.min(b.w, b.iw) - c.wb) / 2) + "px" }) } } }); if (!a.easing.easeout) { a.easing.easeout = function(d, f, b, e, c) { return -e * ((f = f / c - 1) * f * f * f - 1) + b } } })(jQuery); (function(a) { EYE.extend({ zoomimage: { libs: {}, types: /\.jpg|\.jpeg|\.png|\.gif|\.bmp/g, current: null, moved: false, pointer: { x: 0, y: 0 }, diff: { x: 0, y: 0 }, trackKey: false, defaults: { opacity: 0.3, border: 0, shadow: 6, duration: 300, prevent: 14, controls: true, caption: true, hideSource: false, centered: false, className: false, onLoad: function() { return false }, beforeZoomIn: function() { return false }, onZoomIn: function() { return false }, beforeZoomOut: function() { return false }, onZoomOut: function() { return false }, onFocus: function() { return false }, controlsTrigger: "focus", easing: "linear", preload: "click" }, template: ['<div class="zoomimage">', '<div class="zoomimage_s">', '<div class="zoomimage_st">', '<div class="zoomimage_stl"></div>', '<div class="zoomimage_stc"></div>', '<div class="zoomimage_str"></div>', "</div>", '<div class="zoomimage_sc">', '<div class="zoomimage_scl"></div>', '<div class="zoomimage_scc"></div>', '<div class="zoomimage_scr"></div>', "</div>", '<div class="zoomimage_sb">', '<div class="zoomimage_sbl"></div>', '<div class="zoomimage_sbc"></div>', '<div class="zoomimage_sbr"></div>', "</div>", "</div>", '<img src="" />', '<div class="zoomimage_controls">', '<a href="#" class="zoomimage_prev"></a>', '<a href="#" class="zoomimage_next"></a>', "</div>", '<div class="zoomimage_caption"></div>', '<div class="zoomimage_loading"></div>', "</div>"], click: function(c) { var b = this; b.blur(); if (b.zoomimageCfg.loading === true) { return false } if (b.zoomimageCfg.zoomed == false) { EYE.zoomimage.zoomIn(b) } else { EYE.zoomimage.zoomOut(b, false) } return false }, zoomIn: function(c) { if (c.zoomimageCfg.loaded === false) { if (c.zoomimageCfg.loading != true) { c.zoomimageCfg.loading = true; EYE.zoomimage.preload(c) } return } if (c.zoomimageCfg.zoomed == true) { EYE.zoomimage.focus(c); return } c.zoomimageCfg.beforeZoomIn.apply(c, [c.zoomimageCfg.box]); var m = EYE.getPosition(c, true); var g = c.offsetHeight; var n = c.offsetWidth; var l = EYE.getScroll(); var d = c.zoomimageCfg.border + c.zoomimageCfg.shadow; var b = c.zoomimageCfg.width + d * 2; var o = c.zoomimageCfg.height + d * 2; var h = l.iw / l.ih; var e = c.zoomimageCfg.width / c.zoomimageCfg.height; if (h > e) { if (o > l.ih) { o = l.ih; b = parseInt(o * e, 10) } } else { if (b > l.iw) { b = l.iw; o = parseInt(b / e, 10) } } var k = c.zoomimageCfg.centered ? l.t + parseInt((l.ih - o) / 2, 10) : Math.min(Math.max(l.t, m.y + (g - o) / 2 - d), l.t + l.ih - o); var f = c.zoomimageCfg.centered ? l.l + parseInt((l.iw - b) / 2, 10) : Math.min(Math.max(l.l, m.x + (n - b) / 2 - d), l.l + l.iw - b); var j = b - d * 2; var i = o - d * 2; if (c.zoomimageCfg.hideSource === true) { c.style.visibility = "hidden" } a("#" + c.zoomimageCfg.box).css({ top: m.y + "px", left: m.x + "px", width: n + "px", height: g + "px" }).find(">div").hide().end().find("img").attr("src", c.zoomimageCfg.src).css({ top: 0, left: 0, width: "100%", height: "100%", display: "block", borderWidth: "0px" }).end().animate({ width: j, height: i, top: k + d, left: f + d }, c.zoomimageCfg.duration, c.zoomimageCfg.easing, function() { a(this).css({ top: k + "px", left: f + "px", width: b + "px", height: o + "px" }).find("img").css({ top: c.zoomimageCfg.shadow + "px", left: c.zoomimageCfg.shadow + "px", width: j + "px", height: i + "px", borderWidth: c.zoomimageCfg.border + "px" }).end().find(">div:first").find("div.zoomimage_sc").css("height", o - c.zoomimageCfg.shadow * 2 + "px").end().show(); c.zoomimageCfg.zoomed = true; EYE.zoomimage.focus(c); c.zoomimageCfg.onZoomIn.apply(c, [c.zoomimageCfg.box]) }) }, showControls: function(e) { if (e == undefined) { return } if (e.zoomimageCfg == undefined) { e = a("#" + a(e).attr("zoomimage")).get(0) } var b, d, c = e.zoomimageCfg.border + e.zoomimageCfg.shadow; a("#" + e.zoomimageCfg.box).find("img").each(function() { d = parseInt(a.curCSS(this, "width"), 10) }).end().get(0).zoomimageControls = true; if (e.zoomimageCfg.caption) { a("#" + e.zoomimageCfg.box).find(">div:eq(2)").stop().css({ bottom: c + "px", left: c + "px", width: d + "px" }).show().each(function() { this.style.height = "auto"; b = this.offsetHeight; this.style.height = "0" }).animate({ height: b }, e.zoomimageCfg.duration) } if (e.zoomimageCfg.controls) { if (EYE.zoomimage.libs[e.zoomimageCfg.lib] > 1) { a("#" + e.zoomimageCfg.box).find(">div:eq(1)").show().each(function() { if (!e.zoomimageCfg.controlsHeight) { e.zoomimageCfg.controlsHeight = this.offsetHeight } this.style.height = "0" }).css({ top: c + "px", left: c + "px", width: d + "px" }).animate({ height: e.zoomimageCfg.controlsHeight }, e.zoomimageCfg.duration) } } }, zoomOut: function(g, f) { var e, d, c, b; if (g.zoomimageCfg) { if (g.zoomimageCfg.zoomed === false) { return } g.zoomimageCfg.beforeZoomOut.apply(g, [g.zoomimageCfg.box]); e = document.getElementById(g.zoomimageCfg.box) } else { e = g; g = a("a[href=" + a("img", e).attr("src") + "]").get(0) } if (g) { d = EYE.getPosition(g, true); g.zoomimageCfg.zoomed = false; c = g.zoomimageCfg.border + g.zoomimageCfg.shadow; b = { width: g.offsetWidth, height: g.offsetHeight} } else { c = EYE.zoomimage.defaults.border + EYE.zoomimage.defaults.shadow; b = { width: 0, height: 0 }; d = EYE.getPosition(e, true); d.y += parseInt(e.offsetHeight / 2, 10); d.x += parseInt(e.offsetWidth / 2, 10) } a(e).css({ top: e.offsetTop + c + "px", left: e.offsetLeft + c + "px", width: e.offsetWidth - c * 2 + "px", height: e.offsetHeight - c * 2 + "px" }).find(">div").stop().hide().end().find("img").css({ top: 0, left: 0, width: "100%", height: "100%", borderWidth: "0px" }).end().animate({ top: d.y + "px", left: d.x + "px", width: b.width + "px", height: b.height + "px" }, g ? g.zoomimageCfg.duration : EYE.zoomimage.defaults.duration, g.zoomimageCfg.easing, function() { EYE.zoomimage.blur(); a(this).hide(); if (g) { if (g.zoomimageCfg.hideSource === true) { g.style.visibility = "visible" } g.zoomimageCfg.onZoomOut.apply(g, [g.zoomimageCfg.box]); if (!f) { EYE.zoomimage.focus(a("div.zoomimage:visible:last").not(":animated").get(0)) } } else { a(e).stop().remove() } }) }, mouseOver: function(c) { var b = document.getElementById(a(this).attr("zoomimage")); if (b.zoomimageCfg.zoomed === true && this.zoomimageControls == false) { EYE.zoomimage.showControls(b) } return false }, mouseOut: function(b) { if (!EYE.isChildOf(this, b.relatedTarget, this)) { a(this).find(">div:not(:first)").stop().hide(); this.zoomimageControls = false } return false }, mouseDown: function(c) { var b = document.getElementById(a(this).attr("zoomimage")); if (b) { a.extend(EYE.zoomimage, { current: this, prevent: b.zoomimageCfg.prevent, moved: false, diff: { x: c.pageX - this.offsetLeft, y: c.pageY - this.offsetTop }, pointer: { x: c.pageX, y: c.pageY} }); a(document).bind("mousemove", EYE.zoomimage.mouseMove).bind("mouseup", EYE.zoomimage.mouseUp) } else { a(this).zoomimageClear() } return false }, mouseMove: function(d) { var c = Math.abs(EYE.zoomimage.pointer.x - d.pageX); var b = Math.abs(EYE.zoomimage.pointer.y - d.pageY); if (EYE.zoomimage.moved === false) { if (c > EYE.zoomimage.prevent || b > EYE.zoomimage.prevent) { EYE.zoomimage.moved = true; a(EYE.zoomimage.current).addClass("zoomimage_move"); if (!a(EYE.zoomimage.current).is(".zoomimage_focused")) { EYE.zoomimage.focus(EYE.zoomimage.current) } } } else { EYE.zoomimage.current.style.top = d.pageY - EYE.zoomimage.diff.y + "px"; EYE.zoomimage.current.style.left = d.pageX - EYE.zoomimage.diff.x + "px" } return false }, mouseUp: function(b) { a(EYE.zoomimage.current).removeClass("zoomimage_move"); EYE.zoomimage.current = null; a(document).unbind("mousemove", EYE.zoomimage.mouseMove).unbind("mouseup", EYE.zoomimage.mouseUp); return false }, imageClick: function(d) { a(document).unbind("mousemove", EYE.zoomimage.mouseMove).unbind("mouseup", EYE.zoomimage.mouseUp); var c = document.getElementById(a(this).attr("zoomimage")); if (c) { if (EYE.zoomimage.moved === false && a(this).is(".zoomimage_focused")) { if (a(d.target).is("a")) { EYE.zoomimage.zoomNext(c, d.target.className == "zoomimage_next" ? 1 : -1); var b = true } else { EYE.zoomimage.zoomOut(c, b || false) } } else { if (!a(this).is(".zoomimage_focused")) { EYE.zoomimage.focus(this) } } } else { a(this).zoomimageClear() } return false }, clear: function() { var b = this; if (b.size() == 0) { b = a("div.zoomimage") } return b.each(function() { var c = document.getElementById(a(this).attr("zoomimage")); if (c) { EYE.zoomimage.zoomOut(c, false) } else { EYE.zoomimage.zoomOut(this, false) } }) }, zoomNext: function(d, c) { if (d.zoomimageCfg.zoomed === false) { return } EYE.zoomimage.zoomOut(d, true); var f = d.zoomimageCfg.iteration + c; var e = a(d).attr("zoomimage"); var b = EYE.zoomimage.libs[e]; if (f < 0) { f = b - 1 } else { if (f >= b) { f = 0 } } EYE.zoomimage.zoomIn(a('a[zoomimage="' + e + '"]').get(f)) }, keyPressed: function(c) { var b = a("div.zoomimage_focused"); if (b.size() == 1) { var f = c.charCode || c.keyCode || -1; b = a("#" + a(b).attr("zoomimage")).get(0); var d = a(b).attr("zoomimage"); switch (f) { case 35: if (EYE.zoomimage.libs[d] > 1 && EYE.zoomimage.libs[d] - 1 != b.zoomimageCfg.iteration) { EYE.zoomimage.zoomNext(b, EYE.zoomimage.libs[d] - b.zoomimageCfg.iteration - 1); return false } break; case 36: if (EYE.zoomimage.libs[d] > 1 && b.zoomimageCfg.iteration != 0) { EYE.zoomimage.zoomNext(b, -b.zoomimageCfg.iteration); return false } break; case 40: case 37: case 8: case 33: case 80: case 112: if (EYE.zoomimage.libs[d] > 1) { EYE.zoomimage.zoomNext(b, -1); return false } break; case 38: case 39: case 34: case 32: case 110: case 78: if (EYE.zoomimage.libs[d] > 1) { EYE.zoomimage.zoomNext(b, 1); return false } break; case 27: EYE.zoomimage.zoomOut(b, false); return false; break } } }, focus: function(b) { if (b == undefined) { return } if (b.zoomimageCfg == undefined) { b = a("#" + a(b).attr("zoomimage")).get(0) } else { var c = true } EYE.zoomimage.blur(b); a("#" + b.zoomimageCfg.box).not(".zoomimage_focused").addClass("zoomimage_focused"); b.zoomimageCfg.onFocus.apply(b, [b.zoomimageCfg.box]); if (b.zoomimageCfg.controlsTrigger == "focus" || c) { EYE.zoomimage.showControls(b) } }, blur: function(b) { a("div.zoomimage_focused").not("#" + (b == undefined ? "fakezoomimage" : b.zoomimageCfg.box)).removeClass("zoomimage_focused").each(function() { this.zoomimageControls = false }).find(">div:not(:first)").stop().hide() }, preload: function(d) { var c = a("#" + d.zoomimageCfg.box).show(); c.find(">div, img").hide(); var b = EYE.getPosition(d, true); c.find(">div:last").show().end().css({ top: b.y + "px", left: b.x + "px", width: d.offsetWidth + "px", height: d.offsetHeight + "px" }); var e = new Image(); e.src = d.href; if (e.complete) { EYE.zoomimage.markPreloaded(e, d) } else { e.onload = function() { EYE.zoomimage.markPreloaded(e, d) } } }, markPreloaded: function(c, b) { a.extend(b.zoomimageCfg, { loaded: true, width: c.width, height: c.height, src: c.src }); a("#" + b.zoomimageCfg.box).find("div.zoomimage_loading").hide(); if (b.zoomimageCfg.loading) { b.zoomimageCfg.loading = false; EYE.zoomimage.zoomIn(b) } b.zoomimageCfg.onLoad.apply(b, [b.zoomimageCfg.box]) }, init: function(b) { var c = parseInt(Math.random() * 2000, 10); EYE.zoomimage.libs[c] = 0; b = a.extend({ lib: c }, EYE.zoomimage.defaults, b || {}); return this.each(function() { var e = a(this); var f = this; if (f.href && f.href.toLowerCase().match(EYE.zoomimage.types) != null) { f.zoomimageCfg = a.extend({}, b, { zoomed: false, loading: false, loaded: false, animated: false, src: f.href, iteration: EYE.zoomimage.libs[c], box: "zoomimage_" + parseInt(Math.random() * 2000, 10) + "" }); EYE.zoomimage.libs[c]++; e.bind("click", EYE.zoomimage.click).attr("zoomimage", c).attr("zoomimageBox", f.zoomimageCfg.box); var g = e.attr("id"); if (!g) { g = f.zoomimageCfg.box + "_trigger"; e.attr("id", g) } var d = a(f).attr("title"); if (d == "" || d == false) { f.zoomimageCfg.caption = false } a(EYE.zoomimage.template.join("")).attr("id", f.zoomimageCfg.box).attr("zoomimage", g).addClass(f.zoomimageCfg.className).appendTo(document.body).bind("mousedown", EYE.zoomimage.mouseDown).bind("click", EYE.zoomimage.imageClick).each(function() { this.zoomimageControls = false; if (f.zoomimageCfg.controlsTrigger != "focus") { a(this).bind("mouseover", EYE.zoomimage.mouseOver).bind("mouseout", EYE.zoomimage.mouseOut) } }).find(">div").not(":first").css("opacity", f.zoomimageCfg.opacity).end().filter("div:eq(2)").html("<p>" + d + "</p>"); if (f.zoomimageCfg.preload == "load") { EYE.zoomimage.preload(f) } if (EYE.zoomimage.trackKey === false) { EYE.zoomimage.trackKey = true; a(document).bind("keydown", EYE.zoomimage.keyPressed) } } }) } } }); a.fn.extend({ zoomimage: EYE.zoomimage.init, zoomimageClear: EYE.zoomimage.clear }) })(jQuery);