(function(n){var t="767px";n.fn.productImageSlider=function(i){function w(){var i=!1,f;p=n(window).width();n("#menuToggle").css("display")=="block"&&(i=!0);n(window).resize(function(){i=n("#menuToggle").css("display")=="block"?!0:!1});e.thumbnails?e.thumbnails=="bottom"?(r.each(function(){Modernizr.mq("(max-width: "+t+")")?n(this).width(u.width()):n(this).width(Math.ceil(parseInt(e.mainImageWidth*u.width())/100));o=o+n(this).width()}),u.addClass("thumbsBottom"),u.height(r.last().height()+c.outerHeight(!0)),s.width(o)):e.thumbnails=="left"&&(f=e.thumbnailWidth*u.width()/100,c.width(f),u.addClass("thumbsLeft"),r.each(function(){if(Modernizr.mq("(max-width: "+t+")"))n(this).width(u.width());else{var i=parseInt(e.mainImageWidth*u.width()/100-parseInt(c.width()));n(this).width(i)}o=o+n(this).width()}),u.height(r.last().height()),r.first().css("margin-left",c.width()),s.width(o+c.width())):(r.each(function(){Modernizr.mq("(max-width: "+t+")")?n(this).width(u.width()):n(this).width(Math.ceil(parseInt(e.mainImageWidth*u.width())/100));o=o+n(this).width()}),c.remove(),u.height(r.last().height()),s.width(o));e.arrows?nt():l.remove();y=(o-r.width())*-1;r.first().addClass("active");v.first().addClass("active");r.length<2&&l.remove();getProductImageCounter(1,r.length)}function g(){p!=n(window).width()&&(u.removeAttr("style").find("*").removeAttr("style"),h.addClass("disabled"),a.removeClass("disabled"),r.removeClass("active"),v.removeClass("active"),o=0,f=0,y=(o-r.width())*-1,w())}function nt(){e.arrows=="middle"?e.thumbnails=="left"?l.css("left",r.width()-h.width()-2+parseInt(c.width())):e.thumbnails=="bottom"?l.css({left:r.width()-h.width()-2}):l.css("left",r.width()-h.width()-2):e.arrows=="side"&&(l.css({width:u.width()}),a.parent().css({position:"absolute",right:0}),e.thumbnails=="left"?h.parent().css({position:"absolute",left:c.outerWidth(!0)}):e.thumbnails=="bottom"||h.parent().css({position:"absolute",left:0}))}function b(t){t.preventDefault();var u=s.children(".active"),i;f>y&&(f=f-r.width(),s.css("left",f),u.removeClass("active").next().addClass("active"),h.removeClass("disabled"),i=u.next().index(),v.each(function(){var t=n(this).index();i===t?n(this).addClass("active"):n(this).removeClass("active")}),getProductImageCounter(i+1,r.length));f==y&&a.addClass("disabled")}function k(t){t.preventDefault();var i=s.children(".active");f<0&&(f=f+r.width(),s.css("left",f),i.removeClass("active").prev().addClass("active"),a.removeClass("disabled"),index=i.prev().index(),v.each(function(){var t=n(this).index();index===t?n(this).addClass("active"):n(this).removeClass("active")}),getProductImageCounter(index+1,r.length));f==0&&h.addClass("disabled")}function tt(t){t.preventDefault();var i=n(this).parent().index();n(this).parent().addClass("active").siblings().removeClass("active");f=r.width()*i*-1;s.css("left",f);r.each(function(){var t=n(this).index();i===t?n(this).addClass("active"):n(this).removeClass("active")});h.removeClass("disabled");a.removeClass("disabled");f===0?h.addClass("disabled"):f===y&&a.addClass("disabled");getProductImageCounter(i+1,r.length)}var e=n.extend({mainImageWidth:70,thumbnails:"left",thumbnailWidth:15,arrows:"middle"},i),u=this,s=u.children(".slides"),r=s.children("li"),c=u.find(".slideThumbs"),v=c.children("li"),d=v.children("a"),f=parseInt(s.css("left")),y=0,o=0,l=u.children(".buttons"),h=l.children("li").children('a[href="#prev"]'),a=l.children("li").children('a[href="#next"]'),p;return a.click(b),h.addClass("disabled").click(k),d.click(tt),s.swipeEvents().bind("swipeLeft",b).bind("swipeRight",k),p=n(window).width(),[w(),n(window).resize(g)]};n.fn.resizeTextarea=function(){var t=this,i;this.after(function(){return n("<div/>",{"class":"mirrorContainer",css:{height:0,overflow:"hidden"},html:n("<div/>",{"class":"textareaMirror",css:{"min-height":t.outerHeight()}})})}).keyup(function(){i=t.val().replace(/\r|\n/g,"<br />");t.next(".mirrorContainer").children(".textareaMirror").html(i+"<br />");t.height(t.next(".mirrorContainer").children(".textareaMirror").height())}).keydown(function(){t.height(t.next(".mirrorContainer").children(".textareaMirror").height())}).on("reset",function(){alert("reset")})};n.fn.scrollTo=function(t,i){var r=n.extend({offset:0},t);typeof i=="undefined"&&(a=!1);this.length>0&&n("body, html").animate({scrollTop:this.offset().top-r.offset},1e3,i)};n.fn.swipeEvents=function(){return this.each(function(){function e(n){var e=n.originalEvent.touches;e&&e.length&&(r=e[0].pageX,u=e[0].pageY,t.bind("touchmove",i),t.bind("touchend",f))}function i(n){var e=n.originalEvent.touches,o,s;e&&e.length&&(o=r-e[0].pageX,s=u-e[0].pageY,o>=50&&t.trigger("swipeLeft"),o<=-50&&t.trigger("swipeRight"),s>=50&&t.trigger("swipeUp"),s<=-50&&t.trigger("swipeDown"),(Math.abs(o)>=50||Math.abs(s)>=50)&&(t.unbind("touchmove",i),t.unbind("touchend",f)))}function f(){t.unbind("touchmove",i)}var r,u,t=n(this);t.bind("touchstart",e)})};n.preloadImages=function(){for(var t=0;t<arguments.length;t++)n("<img />").attr("src",arguments[t])}})(jQuery),function(n,t,i){typeof define=="function"&&define.amd?define(i):typeof module!="undefined"&&module.exports?module.exports=i():t[n]=i()}("Zoom",this,function(){var t,i,s,h,r,u,f=function(n,t,i){t=t.split(" ");for(var r=0,u=t.length;r<u;r++)n.attachEvent?n.attachEvent("on"+t[r],i):n.addEventListener(t[r],i,!1)},e=function(n,t,i){t=t.split(" ");for(var r=0,u=t.length;r<u;r++)n.detachEvent?n.detachEvent("on"+t[r],i):n.removeEventListener(t[r],i,!1)},o=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1},n=function(n){this.target=n;this.images=n.querySelectorAll("[data-widget-role=zoom-target]");this.isOpen===undefined&&this._init()};return n.prototype._init=function(){var n=this,t,i;for(this._cache={},this.link={},this.image={},this.flyout=document.createElement("div"),this.flyout.className="zoom-flyout",this.notice=document.createElement("div"),this.notice.className="zoom-notice",this._events={open:function(t){n.isOpen||(o(t),n._show(this,t))},move:function(t){n.isOpen&&(o(t),n._move(t))},hide:function(t){n.isOpen&&(o(t),n.hide())}},t=0,i=this.images.length;t<i;t++)f(this.images[t],"click",this._events.open);f(this.target,"mousemove touchmove",this._events.move);f(this.target,"touchend touchcancel",this._events.hide);f(this.flyout,"click",this._events.hide)},n.prototype._show=function(n,r){var u,f,e,o,c=this;if(n.href!==this.link.href){this.link=n;this.image=n.querySelector("img");this._swap(n.href,function(){c._show(n,r)});return}this.target.appendChild(this.flyout);this.offset=function(n){for(var t=n.offsetParent,i={top:n.offsetTop,left:n.offsetLeft};t.nodeName.toLocaleLowerCase()!=="body";)t.nodeName.toLocaleLowerCase()!=="body"&&(i.top+=t.offsetTop,i.left+=t.offsetLeft,t=t.offsetParent);return i}(this.target);u=this.image.clientWidth;f=this.image.clientHeight;e=this.flyout.clientWidth;o=this.flyout.clientHeight;t=this.zoom.clientWidth-e;i=this.zoom.clientHeight-o;s=t/u;h=i/f;this.isOpen=!0;this._move(r)},n.prototype._swap=function(n,t){var i=this,r;this.zoom&&this.flyout.removeChild(this.zoom);r=function(){i.zoom=i.flyout.appendChild(i._cache[n]);t()};this._cache[n]?r():this._load(n,r)},n.prototype._load=function(n,t){var i=this,r=new Image;this.notice.innerHTML="Loading";this.notice=this.target.appendChild(this.notice);this.target.className+=" is-loading";r.onerror=function(){i.link={};i.image={};i.notice.innerHTML="Error";i.target.className=i.target.className.replace(/is-loading/g,"is-error");setTimeout(function(){i.notice=i.target.removeChild(i.notice);i.target.className=i.target.className.replace(/is-error/g,"")},5e3)};r.onload=function(){i._cache[n]=r;i.notice=i.target.removeChild(i.notice);i.target.className=i.target.className.replace(/is-loading/g,"is-ready");t()};r.style.position="absolute";r.src=n},n.prototype._move=function(n){n.type.indexOf("touch")===0?(r=n.touches[0].pageX,u=n.touches[0].pageY):(r=n.pageX||n.clientX+document.body.scrollTop||r,u=n.pageY||n.clientY+document.body.scrollLeft||u);var o=u-this.offset.top,c=r-this.offset.left,f=o*h,e=c*s;f=f>i?i:f;e=e>t?t:e;e>0&&f>0&&(this.zoom.style.top=""+Math.ceil(f)*-1+"px",this.zoom.style.left=""+Math.ceil(e)*-1+"px")},n.prototype.hide=function(){this.isOpen&&(this.flyout=this.target.removeChild(this.flyout),this.isOpen=!1,e(this.target,"click",this._events.hide))},n.prototype.teardown=function(){this.isOpen&&this.hide();for(var n=0,t=this.images.length;n<t;n++)e(this.images[n],"click",this._events.open);e(this.target,"mousemove touchmove",this._events.move);e(this.target,"touchend touchcancel",this._events.hide);delete this.zoom;delete this.link;delete this.image;delete this.notice;delete this.flyout;delete this.isOpen},n})