var MojoZoom=function(){function N(a){return document.getElementById(a)}function k(a){return document.createElement(a)}var I=300,J=300;function o(a,d,b){function h(p){return b(p||window.event)}if(a.addEventListener)a.addEventListener(d,h,false);else a.attachEvent&&a.attachEvent("on"+d,h)}function r(a){var d=a.offsetLeft,b=a.offsetTop;for(a=a.offsetParent;a;){d+=a.offsetLeft;b+=a.offsetTop;a=a.offsetParent}return{x:d,y:b}}function K(a,d){var b=document.body.scrollLeft||document.documentElement.scrollLeft,
h=document.body.scrollTop||document.documentElement.scrollTop;if(d.currentTarget){a=r(a);return{x:d.clientX-a.x+b,y:d.clientY-a.y+h}}return{x:d.offsetX,y:d.offsetY}}function x(a,d,b,h,p,s){if(!a.complete&&!a.__mojoZoomQueued)o(a,"load",function(){a.__mojoZoomQueued=true;setTimeout(function(){x(a,d,b,h,p,s)},1)});else{a.__mojoZoomQueued=false;setTimeout(function(){var y=!!document.all&&!!window.attachEvent&&!window.opera,l=a.offsetWidth,q=a.offsetHeight,j=a.parentNode;if(j.nodeName!="A"){var m=k("a");
j.replaceChild(m,a);m.appendChild(a)}else m=j;m.style.position="relative";m.style.display="block";m.style.width=l+"px";m.style.height=q+"px";var z=a.offsetLeft,A=a.offsetTop,i=k("div");i.className="mojozoom_marker";var e=k("img");e.className="mojozoom_img";e.style.position="absolute";e.style.left="-9999px";e.style.top="-9999px";document.body.appendChild(e);j=a.parentNode;var n=k("div");with(n.style){position="absolute";left=z+"px";top=A+"px";width=l+"px";height=q+"px";overflow="hidden";display="none"}n.appendChild(i);
j.appendChild(n);var t=j;a.__mojoZoomOverlay&&j.removeChild(a.__mojoZoomOverlay);a.__mojoZoomOverlay=n;a.__mojoZoomImage&&a.__mojoZoomImage.parentNode&&a.__mojoZoomImage.parentNode.removeChild(a.__mojoZoomImage);a.__mojoZoomImage=e;var B=false;if(!b){b=k("div");b.className="mojozoom_imgctr";j=r(a);b.style.left=l+j.x+"px";b.style.top=j.y+"px";b.style.width=(h?h:I)+"px";b.style.height=(p?p:J)+"px";document.body.appendChild(b);B=true}b.style.overflow="hidden";if(!s)b.style.visibility="hidden";o(e,"load",
function(){if(e.parentNode){var u=e.offsetWidth,L=e.offsetHeight,C=b.offsetWidth,D=b.offsetHeight,E=u/l,F=L/q,G=Math.round(C/E),H=Math.round(D/F);document.body.removeChild(e);b.appendChild(e);u=k("div");u.className="mojozoom_fill";i.appendChild(u);var v=k("div");v.className="mojozoom_border";i.appendChild(v);i.style.width=G+"px";i.style.height=H+"px";if(s){i.style.left="0px";i.style.top="0px";e.style.left="0px";e.style.top="0px"}var w=false;if(!s){o(t,"mouseout",function(c){var f=c.target||c.srcElement;
if(f)if(f.nodeName=="DIV")if(c=c.relatedTarget||c.toElement){for(;c!=f&&c.nodeName!="BODY"&&c.parentNode;)c=c.parentNode;if(c!=f){w=false;n.style.display="none";b.style.visibility="hidden"}}});o(document.body,"mouseover",function(c){if(w&&!(c.toElement==v||c.target==v)){n.style.display="none";b.style.visibility="hidden";w=false}})}o(t,"mousemove",function(c){w=true;var f=r(a);if(B){b.style.left=l+f.x+"px";b.style.top=f.y+"px"}n.style.display="block";b.style.visibility="visible";var g=K(t,c);if(c.srcElement&&
y){if(c.srcElement==i)return;if(c.srcElement!=t){c=r(c.srcElement);g.x-=f.x-c.x;g.y-=f.y-c.y}}c=G/2;f=H/2;if(!y){g.x-=z;g.y-=A}if(g.x<c)g.x=c;if(g.x>l-c)g.x=l-c;if(g.y<f)g.y=f;if(g.y>q-f)g.y=q-f;c=g.x-c|0;f=g.y-f|0;i.style.left=c+"px";i.style.top=f+"px";e.style.left=-(g.x*E-C/2|0)+"px";e.style.top=-(g.y*F-D/2|0)+"px"})}});setTimeout(function(){e.src=d},1)},1)}}function M(){for(var a=document.getElementsByTagName("img"),d=0;d<a.length;d++){var b=a[d],h=b.getAttribute("data-zoomsrc");h&&x(b,h,document.getElementById(b.getAttribute("id")+
"_zoom"),null,null,b.getAttribute("data-zoomalwaysshow")=="true")}}return{addEvent:o,init:M,makeZoomable:x}}();MojoZoom.addEvent(window,"load",MojoZoom.init);