/*!----------------------------------------------------- * xZoom v1.0.15 * (c) 2013 by Azat Ahmedov & Elman Guseynov * https://github.com/payalord * https://dribbble.com/elmanvebs * Apache License 2.0 *------------------------------------------------------*/(function(){window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozAnimationFrame||window.oAnimationFrame||window.msAnimationFrame||function(o){window.setTimeout(o,20)}}();function eo(){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var o=new Number(RegExp.$1);if(o>=9)return!1;if(o>=8)return!0;if(o>=7)return!0;if(o>=6)return!0;if(o>=5)return!0}else return!1}function Y(o,e,t){o.addEventListener?o.addEventListener(e,t,!1):o.attachEvent&&o.attachEvent("on"+e,t)}function no(o,e,t){o.removeEventListener?o.removeEventListener(e,t,!1):o.detachEvent&&o.detachEvent("on"+e,t)}function Mt(o,e){var t;document.createEvent?(t=document.createEvent("HTMLEvents"),t.initEvent(e,!0,!0)):(t=document.createEventObject(),t.eventType=e),t.eventName=e,o.dispatchEvent?o.dispatchEvent(t):o.fireEvent&&o.fireEvent("on"+t.eventType,t)}function n(o,e){for(var t in e)o.style[t]=e[t]}function F(o){return o.offsetWidth}function E(o){return o.offsetHeight}function B(o,e){o.style.width=typeof e=="number"?e+"px":e}function it(o,e){o.style.height=typeof e=="number"?e+"px":e}function et(o){var e=o.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}}function At(o){return{top:o.offsetTop,left:o.offsetLeft}}function z(o,e){o.appendChild(e)}function pt(o){o&&o.parentNode&&o.parentNode.removeChild(o)}function O(o,e){o.classList.add(e)}function so(o,e){o.classList.remove(e)}var Lt=new WeakMap;function Qt(o,e,t){Lt.has(o)||Lt.set(o,{}),Lt.get(o)[e]=t}function It(o,e){var t=Lt.get(o);return t?t[e]:void 0}function A(o,e){return o.getAttribute(e)}function Nt(o,e,t){o.setAttribute(e,t)}function ao(o,e){o.removeAttribute(e)}function po(o,e){o.innerHTML=e}function lt(o,e,t){var r=1,y=setInterval(function(){r<=.05?(clearInterval(y),n(o,{display:"none",opacity:1}),t&&t()):(r-=r*.1,n(o,{opacity:r}))},1e3/60)}function rt(o,e,t,r){var y=parseFloat(o.style.opacity)||0,f=t-y,c=null;function g(L){c||(c=L);var H=(L-c)/e,d=y+f*H;n(o,{opacity:d}),H<1?requestAnimationFrame(g):n(o,{opacity:t})}requestAnimationFrame(g)}function K(o){return document.createElement(o)}function Ut(o,e){return e=e||document,e.querySelector(o)}function lo(o,e){return e=e||document,Array.prototype.slice.call(e.querySelectorAll(o))}function Tt(o,e){this.xzoom=!0;var t=this,r,y=null,f,c,g,L,H,d,m,C,h,Xt,Yt,G,P,x,R,a,Q,ft,qt,ct=[],ut=0,Ct=0,nt,w,v,$,S,k,I,N,U,V,j,tt,Z,D,Rt,T=0,_,J,st,dt=0,ht=0,Wt=0,bt=0,Ht=0,zt=0,Zt=0,Dt=0,_t=0,Bt=0,St=eo(),ro=/MSIE (\d+\.\d+);/.test(navigator.userAgent),Vt,Ot,vt,ot="",Et,q,Gt,jt,M,X,gt,mt,kt,Pt;this.adaptive=function(){(M===0||X===0)&&(n(o,{width:"",height:""}),M=F(o),X=E(o)),xt(),Gt=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,jt=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,gt=F(o),mt=E(o);var i=!1;(M>Gt||X>jt)&&(i=!0),gt>M&&(gt=M),mt>X&&(mt=X),i?B(o,"100%"):M!==0&&B(o,M),kt!="fullscreen"&&(fo()?t.options.position=kt:t.options.position=t.options.mposition),t.options.lensReverse||(Pt=t.options.adaptiveReverse&&t.options.position==t.options.mposition)};function to(){var i=document.documentElement,s=(window.pageXOffset||i.scrollLeft)-(i.clientLeft||0),p=(window.pageYOffset||i.scrollTop)-(i.clientTop||0);return{left:s,top:p}}function fo(){var i=et(o);if(t.options.zoomWidth=="auto"?g=gt:g=t.options.zoomWidth,t.options.zoomHeight=="auto"?L=mt:L=t.options.zoomHeight,t.options.position.substr(0,1)=="#"?y=Ut(t.options.position):y=null,y)return!0;switch(kt){case"lens":case"inside":return!0;case"top":d=i.top,m=i.left,C=d-L,h=m;break;case"left":d=i.top,m=i.left,C=d,h=m-g;break;case"bottom":d=i.top,m=i.left,C=d+mt,h=m;break;case"right":default:d=i.top,m=i.left,C=d,h=m+gt}return!(h+g>Gt||h<0)}this.xscroll=function(i){if(i.preventDefault(),G=i.pageX||i.originalEvent.pageX,P=i.pageY||i.originalEvent.pageY,i.xscale)T=i.xscale,Kt(G,P);else{var s=-i.detail||i.wheelDelta||i.xdelta,p=G,l=P;St&&(p=Vt,l=Ot),s>0?s=-.05:s=.05,T+=s,Kt(p,l)}};function $t(){if(t.options.lensShape==="circle"&&t.options.position==="lens"){t.options.initialLensWidth!=="auto"&&t.options.initialLensHeight!=="auto"&&!isNaN(t.options.initialLensWidth)&&isNaN(t.options.initialLensHeight),S=k=Math.max(S,k);var i=(S+Math.max(V,U)*2)/2;n(v,{"-moz-border-radius":i+"px","-webkit-border-radius":i+"px","border-radius":i+"px"})}}function Jt(i,s,p,l){if(t.options.position==="lens"){var u=-(i-m)*j+S/2,W=-(s-d)*tt+k/2,wt=S-p,b=k-l;u=Math.max(wt,Math.min(0,u)),W=Math.max(b,Math.min(0,W)),n(w,{top:W+"px",left:u+"px"}),t.options.bg&&(n(v,{"background-image":"url("+A(w,"src")+")","background-repeat":"no-repeat","background-position":-(i-m)*j+S/2+"px "+(-(s-d)*tt+k/2)+"px"}),p&&l&&n(v,{"background-size":p+"px "+l+"px"}))}else{var u=-I*j,W=-N*tt,wt=g-p,b=L-l;u=Math.max(wt,Math.min(0,u)),W=Math.max(b,Math.min(0,W)),n(w,{top:W+"px",left:u+"px"})}}function Kt(i,s){T<-1&&(T=-1),T>1&&(T=1);var p,l,u;Z=S&&I>f-S&&(I=f-S),f=k&&N>c-k&&(N=c-k),c"+ot+""),z(q,Et),t.options.fadeIn&&n(q,{opacity:0})),v=K("div"),t.options.lensClass!=""&&O(v,t.options.lensClass),n(v,{position:"absolute",overflow:"hidden"}),t.options.lens){var s=K("div");n(s,{position:"absolute",background:t.options.lens,opacity:t.options.lensOpacity,width:"100%",height:"100%",top:0,left:0,"z-index":9999}),z(v,s)}co(),t.options.position!="inside"&&t.options.position!="fullscreen"?((t.options.tint||St)&&z(x,R),t.options.fadeIn?(n(R,{opacity:0}),n(v,{opacity:0}),n(a,{opacity:0})):(n(R,{opacity:t.options.tintOpacity}),n(v,{opacity:1}),n(a,{opacity:1})),z(r,x)):(t.options.fadeIn&&n(a,{opacity:0}),z(r,x)),t.eventmove(x),t.eventleave(x);var p=E(a)+parseFloat(getComputedStyle(a).marginTop)+parseFloat(getComputedStyle(a).marginBottom)+parseFloat(getComputedStyle(a).borderTopWidth)+parseFloat(getComputedStyle(a).borderBottomWidth)+parseFloat(getComputedStyle(a).paddingTop)+parseFloat(getComputedStyle(a).paddingBottom),l=F(a)+parseFloat(getComputedStyle(a).marginLeft)+parseFloat(getComputedStyle(a).marginRight)+parseFloat(getComputedStyle(a).borderLeftWidth)+parseFloat(getComputedStyle(a).borderRightWidth)+parseFloat(getComputedStyle(a).paddingLeft)+parseFloat(getComputedStyle(a).paddingRight);switch(t.options.position){case"inside":C-=(p-E(a))/2,h-=(l-F(a))/2;break;case"top":C-=p-E(a),h-=(l-F(a))/2;break;case"left":C-=(p-E(a))/2,h-=l-F(a);break;case"bottom":h-=(l-F(a))/2;break;case"right":C-=(p-E(a))/2}n(a,{top:C+"px",left:h+"px"}),Y(w,"load",function(u){if(pt(Q),!t.options.openOnSmall&&(F(w)f||p<0||p>c)&&Mt(x,"mouseleave"),t.options.smooth?(dt=i.pageX,ht=i.pageY):($t(),Ft(i.pageX,i.pageY),n(v,{top:N-V+"px",left:I-U+"px"}),n($,{top:-N+"px",left:-I+"px"}),Jt(i.pageX,i.pageY,F(w),E(w)))},this.eventdefault=function(){t.eventopen=function(i){Y(i,"mouseenter",t.openzoom)},t.eventleave=function(i){Y(i,"mouseleave",t.closezoom)},t.eventmove=function(i){Y(i,"mousemove",t.movezoom)},t.eventscroll=function(i){Y(i,"mousewheel",t.xscroll),Y(i,"DOMMouseScroll",t.xscroll),Y(i,"wheel",t.xscroll)},t.eventclick=function(i){Y(i,"click",function(s){Mt(o,"click")})}},this.eventunbind=function(){no(o,"mouseenter",t.openzoom),t.eventopen=function(){},t.eventleave=function(){},t.eventmove=function(){},t.eventscroll=function(){},t.eventclick=function(){}},this.init=function(i){t.options=Object.assign({},Tt.defaults,i),t.options.rootOutput?r=document.body:r=o.parentNode,kt=t.options.position,Pt=t.options.lensReverse&&t.options.position=="inside",t.options.smoothZoomMove<1&&(t.options.smoothZoomMove=1),t.options.smoothLensMove<1&&(t.options.smoothLensMove=1),t.options.smoothScale<1&&(t.options.smoothScale=1),t.options.initialLensWidth!=="auto"&&(!isFinite(t.options.initialLensWidth)||t.options.initialLensWidth<=0)&&(console.warn("xZoom: Invalid initialLensWidth, falling back to auto"),t.options.initialLensWidth="auto"),t.options.initialLensHeight!=="auto"&&(!isFinite(t.options.initialLensHeight)||t.options.initialLensHeight<=0)&&(console.warn("xZoom: Invalid initialLensHeight, falling back to auto"),t.options.initialLensHeight="auto"),t.options.adaptive&&Y(window,"load",function(){M=F(o),X=E(o),t.options.initialLensWidth!=="auto"&&t.options.initialLensWidth>M&&(console.warn("xZoom: initialLensWidth exceeds source image width, capping to source width"),t.options.initialLensWidth=M),t.options.initialLensHeight!=="auto"&&t.options.initialLensHeight>X&&(console.warn("xZoom: initialLensHeight exceeds source image height, capping to source height"),t.options.initialLensHeight=X),t.adaptive(),Y(window,"resize",t.adaptive)}),t.eventdefault(),t.eventopen(o)},this.destroy=function(){t.eventunbind()},this.closezoom=function(){st=!1,t.options.fadeOut?(t.options.title&&ot!=""&<(q),t.options.position!="inside"||t.options.position!="fullscreen"?(lt(a),lt(x,300,function(){xt()})):lt(x,300,function(){xt()})):xt()},this.gallery=function(){var i=[],s,p=0;for(s=Ct;s"u")?!1:(Qt(r,"xzoom",r.x),Mt(r,"xzoom_ready"),r.xob)}})();