// Zoom 1.3 - jQuery image zooming plugin
// (c) 2011 Jack Moore - jacklmoore.com
// license: www.opensource.org/licenses/mit-license.php
(function(a){var b={url:!1,icon:!0,grab:!1,callback:!1,duration:120};a.fn.zoom=function(c){return this.each(function(){var d=this,e=a(d),f=new Image,g=a(f),h,i=e.css("position"),j=a.extend({},b,c||{}),k="mousemove";e.css({position:/(absolute|fixed)/.test(i)?i:"relative",overflow:"hidden"});if(!j.url){j.url=e.find("img:first")[0].src;if(!j.url)return}j.icon&&(h=a('<div class="zoomIcon">').appendTo(e)),f.onload=function(){function n(){b=e.outerWidth(),c=e.outerHeight(),d=(f.width-b)/b,h=(f.height-c)/c}function o(a){i=a.pageX-m.left,l=a.pageY-m.top,i>b?i=b:i<0&&(i=0),l>c?l=c:l<0&&(l=0),f.style.left=i*-d+"px",f.style.top=l*-h+"px",a.preventDefault()}var b,c,d,h,i,l,m=e.offset();n(),g.addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:f.width,height:f.height,border:"none"}).appendTo(e),j.grab?g.mousedown(function(b){m=e.offset(),a(document).one("mouseup",function(){g.stop().fadeTo(j.duration,0),a(document).unbind(k,o)}),n(),o(b),g.stop().fadeTo(a.support.opacity?j.duration:0,1),a(document)[k](o),b.preventDefault()}):g.hover(function(){m=e.offset(),n(),g.stop().fadeTo(a.support.opacity?j.duration:0,1)},function(){g.stop().fadeTo(j.duration,0)})[k](function(a){f.style.left=(a.pageX-m.left)*-d+"px",f.style.top=(a.pageY-m.top)*-h+"px"}),a.isFunction(j.callback)&&j.callback.call(f)},f.src=j.url})},a.fn.zoom.defaults=b})(jQuery);
