!function($){function format(t){for(var o=1;o<arguments.length;o++)t=t.replace("%"+(o-1),arguments[o]);return t}function CloudZoom(t,o){var e,i,n,s,a,l,r,d,u=$("img",t),c=null,p=null,h=null,m=null,f=null,g=null,v=0,x=0,y=0,b=0,z=0,O=0,k=this;setTimeout(function(){if(null===p){var o=t.width();t.parent().append(format('<div style="width:%0px;position:absolute;top:75%;left:%1px;text-align:center" class="cloud-zoom-loading" >Loading...</div>',o/3,o/2-o/6)).find(":last").css("opacity",.5)}},200);this.removeBits=function(){h&&(h.remove(),h=null),m&&(m.remove(),m=null),f&&(f.remove(),f=null),null!==g&&(g.remove(),g=null),$(".cloud-zoom-loading",t.parent()).remove()},this.destroy=function(){t.data("zoom",null),p&&(p.unbind(),p.remove(),p=null),c&&(c.remove(),c=null),this.removeBits()},this.fadedOut=function(){c&&(c.remove(),t.trigger("cloudzoom_end_zoom"),c=null),this.removeBits()},this.controlLoop=function(){if(h){var t=l-u.offset().left-.5*s>>0,e=r-u.offset().top-.5*a>>0;t<0?t=0:t>u.outerWidth()-s&&(t=u.outerWidth()-s),e<0?e=0:e>u.outerHeight()-a&&(e=u.outerHeight()-a),h.css({left:t,top:e}),h.css("background-position",-t+"px "+-e+"px"),x=t/u.outerWidth()*n.width>>0,y=e/u.outerHeight()*n.height>>0,z+=(x-z)/o.smoothMove,b+=(y-b)/o.smoothMove,c.css("background-position",-(z>>0)+"px "+-(b>>0)+"px")}v=setTimeout(function(){k.controlLoop()},30)},this.init2=function(t,o){1===o&&(n=t),2===++O&&this.init()},this.init=function(){$(".cloud-zoom-loading",t.parent()).remove(),p=t.parent().append(format("<div class='mousetrap' style='background-image:url(\".\");z-index:999;position:absolute;width:%0px;height:%1px;left:%2px;top:%3px;'></div>",u.outerWidth(),u.outerHeight(),0,0)).find(":last");var e="ontouchstart"in document.documentElement;p.bind("touchmove mousemove",this,function(t){l=void 0!==t.originalEvent.touches?t.originalEvent.touches[0].pageX:t.pageX,r=void 0!==t.originalEvent.touches?t.originalEvent.touches[0].pageY:t.pageY}),p.bind("touchend mouseleave",this,function(t){return clearTimeout(v),h&&h.fadeOut(50),m&&m.fadeOut(50),f&&f.fadeOut(50),c.fadeOut(50,function(){k.fadedOut(),null!=p&&p.css("z-index","auto")}),!1}),p.bind("touchstart mouseenter",this,function(i){p.css("z-index","999"),e&&i.preventDefault(),l=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageX:i.pageX,r=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageY:i.pageY,d=i.data,c&&(c.stop(!0,!1),c.remove());var g=o.adjustX,v=o.adjustY,x=u.outerWidth(),y=u.outerHeight(),b=o.zoomWidth,z=o.zoomHeight;"auto"==o.zoomWidth&&(b=x),"auto"==o.zoomHeight&&(z=y);var O=t.parent();switch(o.position){case"top":v-=z;break;case"right":g+=x;break;case"bottom":v+=y;break;case"left":g-=b;break;case"inside":b=x,z=y;break;default:(O=$("#"+o.position)).length?(b=O.innerWidth(),z=O.innerHeight()):(O=t,g+=x,v+=y)}c=O.append(format('<div id="cloud-zoom-big" class="cloud-zoom-big" style="display:none;position:absolute;left:0px;top:0px;width:%2px;height:%3px;background-image:url(\'%4\');z-index:99;"></div>',g,v,b,z,n.src)).find(":last"),u.attr("title")&&o.showTitle&&c.append(format('<div class="cloud-zoom-title">%0</div>',u.attr("title"))).find(":last").css("opacity",o.titleOpacity),c.fadeIn(500),h&&(h.remove(),h=null),s=u.outerWidth()/n.width*c.width(),a=u.outerHeight()/n.height*c.height(),h=t.append(format("<div class='cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div>",s,a)).find(":last"),p.css("cursor",h.css("cursor"));var k=!1;o.tint&&(h.css("background",'url("'+u.attr("src")+'")'),(m=t.append(format('<div style="display:none;position:absolute; left:0px; top:0px; width:%0px; height:%1px; background-color:%2;" />',u.outerWidth(),u.outerHeight(),o.tint)).find(":last")).css("opacity",o.tintOpacity),k=!0,m.fadeIn(500)),o.softFocus&&(h.css("background",'url("'+u.attr("src")+'")'),(f=t.append(format('<div style="position:absolute;display:none;top:2px; left:2px; width:%0px; height:%1px;" />',u.outerWidth()-2,u.outerHeight()-2,o.tint)).find(":last")).css("background",'url("'+u.attr("src")+'")'),f.css("opacity",.5),k=!0,f.fadeIn(500)),k||h.css("opacity",o.lensOpacity),"inside"!==o.position&&h.fadeIn(500),d.controlLoop()})},e=new Image,$(e).load(function(){k.init2(this,0)}),e.src=u.attr("src"),i=new Image,$(i).load(function(){k.init2(this,1)}),i.src=t.attr("href")}$(document).ready(function(){$(".cloud-zoom, .cloud-zoom-gallery").CloudZoom()}),$.fn.CloudZoom=function(options){try{document.execCommand ("BackgroundImageCache",!1,!0)}catch(t){}return this.each(function(){var relOpts,opts;if(eval("var\ta={"+$(this).attr("rel")+"}"),relOpts=a,$(this).is(".cloud-zoom"))$(this).css({position:"relative",display:"block"}),$("img",$(this)).css({display:"block"}),"wrap"!=$(this).parent().attr("id")&&$(this).wrap('<div id="wrap" style="top:0px;z-index:auto;position:relative;"></div>'),opts=$.extend({},$.fn.CloudZoom.defaults,options),opts=$.extend({},opts,relOpts),$(this).data("zoom",new CloudZoom($(this),opts));else if($(this).is(".cloud-zoom-gallery")){opts=$.extend({},relOpts,options),$(this).data("relOpts",opts);var m_click="touchstart click";$(this).bind(m_click,$(this),function(t){var o=t.data.data("relOpts");return $("#"+o.useZoom).data("zoom").destroy(),$("#"+o.useZoom).attr("href",t.data.attr("href")),$("#"+o.useZoom+" img").attr("src",t.data.data("relOpts").smallImage),$("#"+t.data.data("relOpts").useZoom).CloudZoom(),!1})}}),this},$.fn.CloudZoom.defaults={zoomWidth:"auto",zoomHeight:"auto",position:"right",tint:!1,tintOpacity:.5,lensOpacity:.5,softFocus:!1,smoothMove:3,showTitle:!0,titleOpacity:.5,adjustX:0,adjustY:0}}(jQuery);