text: ﻿(function(n){var r={hover:{mousedown:n.noop,mousemove:function(n,t){t.target.spritezoom("showLayer",["view","tint","zoom","lens"]);t.target.spritezoom("update")},mouseup:n.noop,mouseenter:function(n,t){t.target.spritezoom("update");t.target.spritezoom("showLayer",["view","tint","zoom","lens"])},mouseover:function(n,t){t.target.spritezoom("showLayer",["view","tint","zoom","lens"])},mouseleave:function(n,t){t.target.spritezoom("hideLayer",["tint","zoom","lens"]);t.target.spritezoom("update")},dblclick:n.noop},click:{mousedown:function(n,t){t.target.spritezoom("showLayer",["view","tint","zoom","lens"]);t.target.spritezoom("update")},mousemove:function(n,t){t.target.spritezoom("update")},mouseup:function(n,t){t.target.spritezoom("hideLayer",["tint","zoom","lens"]);t.target.spritezoom("update")},mouseenter:function(n,t){t.target.spritezoom("update")},mouseover:n.noop,mouseleave:function(n,t){t.target.spritezoom("hideLayer",["tint","zoom","lens"]);t.target.spritezoom("update")},dblclick:n.noop}},i={init:function(i){return this.each(function(){var r={fadeInSpeed:500,fadeOutSpeed:300,behavior:"hover",layout:"inner",border:4,magSize:.3,source:undefined,image:undefined,title:undefined,width:undefined,height:undefined,offset:undefined,zSource:undefined,zImage:undefined,zTitle:undefined,zWidth:undefined,zHeight:undefined,zOffset:undefined},u,f,e;if(i=i||{},n.extend(!0,r,i),u=n(this),f=u.data("spritezoom"),f)n.extend(!0,f,i),t.reload(f);else{try{document.execCommand("BackgroundImageCache",!1,!0)}catch(o){}u.is("a")&&u.children().first().is("img")&&(r.title||(r.title=u.attr("title")),e=u.children().first(),r.zTitle||(r.zTitle=e.attr("title")),r.source=e.attr("src"),r.zSource=u.attr("href"),u.click(function(){return!1}));u.empty();r.viewEl=n("<div class='spritezoom-view'><\/div>").appendTo(u);r.tintEl=n("<div class='spritezoom-tint'><\/div>").appendTo(u).hide();r.lensEl=n("<div class='spritezoom-lens'><\/div>").appendTo(u).hide();r.zoomEl=n("<div class='spritezoom-zoom'><\/div>").appendTo(u).hide();r.sensEl=n("<div class='spritezoom-sens'><\/div>").appendTo(u);r.target=u;r.target.addClass("spritezoom-instance");r.view={el:r.viewEl,opacity:1};r.tint={el:r.tintEl,opacity:.5};r.lens={el:r.lensEl,opacity:1};r.zoom={el:r.zoomEl,opacity:1};r.touchable=/iphone|ipod|ipad|android/i.test(navigator.userAgent);u.data("spritezoom",r);t.reload(r)}})},destroy:function(){return this.each(function(){n(this).unbind(".spritezoom").removeData("spritezoom")})},update:function(){return this.each(function(){t.updateBackground(n(this).data("spritezoom"))})},showLayer:function(t){for(var f=n(this),i,u=f.data("spritezoom"),r=0;r<t.length;r++)i=u[t[r]],(i.fadingOut||!i.fadingIn)&&(i.fadingOut=!1,i.fadingIn=!0,i.el.stop(!1,!0).fadeTo(u.fadeInSpeed,i.opacity,function(){i.fadingIn=!1}))},hideLayer:function(t){for(var f=n(this),i,u=f.data("spritezoom"),r=0;r<t.length;r++)i=u[t[r]],(!i.fadingOut||i.fadingIn)&&(i.fadingOut=!0,i.fadingIn=!1,i.el.stop(!1,!0).fadeTo(u.fadeOutSpeed,0,function(){i.fadingOut=!1}))}},t={wrap:function(t,i){return typeof t=="function"?function(n){t.apply(i.target,[n,i])}:n.noop},prevent:function(n){return n.cancelable&&n.preventDefault(),!1},storePoints:function(n,t){n.touches===undefined&&n.originalEvent!==undefined&&(n.touches=n.originalEvent.touches);n.touches!==undefined&&n.touches.length>0?(t.currentX=n.touches[0].pageX,t.currentY=n.touches[0].pageY):(t.currentX=n.pageX,t.currentY=n.pageY);var i=t.target.offset();return t.targetX=t.currentX-i.left,t.targetY=t.currentY-i.top,!1},resetPoints:function(n,t){t.currentX=undefined;t.currentY=undefined;t.targetX=undefined;t.targetY=undefined},clamp:function(n,t,i){return n<t?t:n>i?i:n},reload:function(n){var u=0,i=new Image,r=new Image,f=function(){u+=1;u==2&&(n.image=i,n.zImage=r,t.reconfiger(n))};i.onload=r.onload=f;i.src=n.source;r.src=n.zSource},reconfiger:function(n){n.width=n.width||n.image.width;n.height=n.height||n.image.height;n.offset=n.offset||{x:0,y:0};n.zWidth=n.zWidth||n.zImage.width;n.zHeight=n.zHeight||n.zImage.height;n.zOffset=n.zOffset||{x:0,y:0};t.initializeBackground(n);t.updateBackground(n);t.rebindEvents(n);n.target.trigger("onLoad",n)},initializeBackground:function(n){var i=n.width,f=n.zWidth,r=n.height,e=n.zHeight,t,u;n.target.css({position:"relative",top:0,left:0,overflow:"visible",width:i,height:r});t={position:"absolute",top:0,left:0,overflow:"hidden",width:i,height:r};n.sensEl.css(t);n.tintEl.css(t);n.viewEl.css(t).css({"background-image":["url('",n.source,"')"].join(""),"background-repeat":"no-repeat","background-position":[-n.offset.x,"px ",-n.offset.y,"px"].join("")});u=n.layout=="magnify"?n.zSource:n.source;n.lensEl.css(t).css({"background-image":["url('",u,"')"].join(""),"background-repeat":"no-repeat","background-position":[-n.offset.x,"px ",-n.offset.y,"px"].join(""),width:Math.round(i*n.magSize),height:Math.round(i*n.magSize)});n.zoomEl.css({"background-image":["url('",n.zSource,"')"].join(""),"background-repeat":"no-repeat","background-position":[-n.zOffset.x,"px ",-n.zOffset.y,"px"].join("")});switch(n.layout){case"magnify":n.zoomEl.css(t).css({"background-image":"none"});break;case"inner":n.zoomEl.css(t);n.lensEl.remove();break;case"right":n.zoomEl.css(t).css({left:t.width+n.border*2});break;case"left":n.zoomEl.css(t).css({left:-(t.width+n.border*2)});break;case"top":n.zoomEl.css(t).css({top:-(t.height+n.border*2)});break;case"bottom":n.zoomEl.css(t).css({top:t.height+n.border*2})}typeof n.layout=="function"&&n.layout.apply(n.zoomEl,[n]);n.zoomEl.empty();n.zTitle&&n.zoomEl.append("<div class='spritezoom-title'>"+n.zTitle+"<\/div>");n.viewEl.empty();n.title&&n.viewEl.append("<div class='spritezoom-title'>"+n.title+"<\/div>")},updateBackground:function(n){var u=n.width,l=n.zWidth,f=n.lensEl.innerWidth(),e=n.height,a=n.zHeight,o=n.lensEl.innerHeight(),i,r;i=Math.round(n.targetX/u*l-u*.5);r=Math.round(n.targetY/e*a-u*.5);i=t.clamp(i,0,l-u)+n.zOffset.x;r=t.clamp(r,0,a-e)+n.zOffset.y;n.zoomEl.css({"background-position":[-i,"px ",-r,"px"].join("")});i=Math.round(n.targetX-f*.5);r=Math.round(n.targetY-o*.5);i=t.clamp(i,0,u-f);r=t.clamp(r,0,e-o);n.lensEl.css({position:"absolute",top:r,left:i});var s=n.width,h=n.height,v=n.source,c=n.offset;n.layout=="magnify"&&(s=n.zWidth,h=n.zHeight,v=n.zSource,c=n.zOffset);i=Math.round(n.targetX/u*s-f*.5);r=Math.round(n.targetY/e*h-o*.5);i=t.clamp(i,0,s-f)+c.x;r=t.clamp(r,0,h-o)+c.y;n.lensEl.css({"background-position":[-i,"px ",-r,"px"].join("")})},rebindEvents:function(n){var f=n.target,i=n.sensEl,u;f.unbind(".spritezoom");i.unbind(".spritezoom");i.bind("mousemove.spritezoom",function(n){t.storePoints(n,f.data("spritezoom"))});u=n.behavior||{};typeof u=="string"&&(u=r[n.behavior]||{});i.bind("mousedown.spritezoom",t.wrap(u.mousedown,n));i.bind("mousemove.spritezoom",t.wrap(u.mousemove,n));i.bind("mouseup.spritezoom",t.wrap(u.mouseup,n));i.bind("mouseenter.spritezoom",t.wrap(u.mouseenter,n));i.bind("mouseover.spritezoom",t.wrap(u.mouseover,n));i.bind("mouseleave.spritezoom",t.wrap(u.mouseleave,n));i.bind("dblclick.spritezoom",t.wrap(u.dblclick,n));n.touchable&&(i.bind("touchstart.spritezoom",t.wrap(u.touchstart,n)),i.bind("touchmove.spritezoom",t.wrap(u.touchmove,n)),i.bind("touchend.spritezoom",t.wrap(u.touchend,n)),i.bind("touchcancel.spritezoom",t.wrap(u.touchcancel,n)),i.bind("click.spritezoom",t.prevent),i.bind("gesturestart.spritezoom",t.prevent),i.bind("gesturechange.spritezoom",t.prevent),i.bind("gestureend.spritezoom",t.prevent));typeof n.onLoad=="function"&&f.bind("onLoad.spritezoom",n.onLoad)}};n.fn.spritezoom=function(t){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return i.init.apply(this,arguments);n.error("Method "+t+" does not exist on jQuery.spritezoom")}})(window.jQuery);
  //# sourceMappingURL=jquery.spritezoom.min.js.map
  