/*
parallax.js v1.5.0 (http://pixelcog.github.io/parallax.js/)
@copyright 2016 PixelCog, Inc.
@license MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE)
*/
(function(e,g,k,h){function c(a,b){var f=this;"object"==typeof b&&(delete b.refresh,delete b.render,e.extend(this,b));this.$element=e(a);!this.imageSrc&&this.$element.is("img")&&(this.imageSrc=this.$element.attr("src"));var d=(this.position+"").toLowerCase().match(/\S+/g)||[];1>d.length&&d.push("center");1==d.length&&d.push(d[0]);if("top"==d[0]||"bottom"==d[0]||"left"==d[1]||"right"==d[1])d=[d[1],d[0]];this.positionX!==h&&(d[0]=this.positionX.toLowerCase());this.positionY!==h&&(d[1]=this.positionY.toLowerCase());
f.positionX=d[0];f.positionY=d[1];"left"!=this.positionX&&"right"!=this.positionX&&(isNaN(parseInt(this.positionX))?this.positionX="center":this.positionX=parseInt(this.positionX));"top"!=this.positionY&&"bottom"!=this.positionY&&(isNaN(parseInt(this.positionY))?this.positionY="center":this.positionY=parseInt(this.positionY));this.position=this.positionX+(isNaN(this.positionX)?"":"px")+" "+this.positionY+(isNaN(this.positionY)?"":"px");if(navigator.userAgent.match(/(iPod|iPhone|iPad)/))return this.imageSrc&&
this.iosFix&&!this.$element.is("img")&&this.$element.css({backgroundImage:"url("+this.imageSrc+")",backgroundSize:"cover",backgroundPosition:this.position}),this;if(navigator.userAgent.match(/(Android)/))return this.imageSrc&&this.androidFix&&!this.$element.is("img")&&this.$element.css({backgroundImage:"url("+this.imageSrc+")",backgroundSize:"cover",backgroundPosition:this.position}),this;this.$mirror=e("<div />").prependTo(this.mirrorContainer);d=this.$element.find(">.parallax-slider");var g=!1;
0==d.length?this.$slider=e("<img />").prependTo(this.$mirror):(this.$slider=d.prependTo(this.$mirror),g=!0);this.$mirror.addClass("parallax-mirror").css({visibility:"hidden",zIndex:this.zIndex,position:"fixed",top:0,left:0,overflow:"hidden"});this.$slider.addClass("parallax-slider").one("load",function(){f.naturalHeight&&f.naturalWidth||(f.naturalHeight=this.naturalHeight||this.height||1,f.naturalWidth=this.naturalWidth||this.width||1);f.aspectRatio=f.naturalWidth/f.naturalHeight;c.isSetup||c.setup();
c.sliders.push(f);c.isFresh=!1;c.requestRender()});g||(this.$slider[0].src=this.imageSrc);(this.naturalHeight&&this.naturalWidth||this.$slider[0].complete||0<d.length)&&this.$slider.trigger("load")}(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!g.requestAnimationFrame;++c)g.requestAnimationFrame=g[b[c]+"RequestAnimationFrame"],g.cancelAnimationFrame=g[b[c]+"CancelAnimationFrame"]||g[b[c]+"CancelRequestAnimationFrame"];g.requestAnimationFrame||(g.requestAnimationFrame=function(c){var b=
(new Date).getTime(),d=Math.max(0,16-(b-a)),e=g.setTimeout(function(){c(b+d)},d);a=b+d;return e});g.cancelAnimationFrame||(g.cancelAnimationFrame=function(a){clearTimeout(a)})})();e.extend(c.prototype,{speed:.2,bleed:0,zIndex:-100,iosFix:!0,androidFix:!0,position:"center",overScrollFix:!1,mirrorContainer:"body",refresh:function(){this.boxWidth=this.$element.outerWidth();this.boxHeight=this.$element.outerHeight()+2*this.bleed;this.boxOffsetTop=this.$element.offset().top-this.bleed;this.boxOffsetLeft=
this.$element.offset().left;this.boxOffsetBottom=this.boxOffsetTop+this.boxHeight;var a=c.winHeight,b=Math.min(this.boxOffsetTop,c.docHeight-a);a=this.boxHeight+(b-Math.max(this.boxOffsetTop+this.boxHeight-a,0))*(1-this.speed)|0;b=(this.boxOffsetTop-b)*(1-this.speed)|0;a*this.aspectRatio>=this.boxWidth?(this.imageWidth=a*this.aspectRatio|0,this.imageHeight=a,this.offsetBaseTop=b,a=this.imageWidth-this.boxWidth,"left"==this.positionX?this.offsetLeft=0:"right"==this.positionX?this.offsetLeft=-a:isNaN(this.positionX)?
this.offsetLeft=-a/2|0:this.offsetLeft=Math.max(this.positionX,-a)):(this.imageWidth=this.boxWidth,this.imageHeight=this.boxWidth/this.aspectRatio|0,this.offsetLeft=0,a=this.imageHeight-a,"top"==this.positionY?this.offsetBaseTop=b:"bottom"==this.positionY?this.offsetBaseTop=b-a:isNaN(this.positionY)?this.offsetBaseTop=b-a/2|0:this.offsetBaseTop=b+Math.max(this.positionY,-a))},render:function(){var a=c.scrollTop,b=c.scrollLeft,e=this.overScrollFix?c.overScroll:0,d=a+c.winHeight;this.boxOffsetBottom>
a&&this.boxOffsetTop<=d?(this.visibility="visible",this.mirrorTop=this.boxOffsetTop-a,this.mirrorLeft=this.boxOffsetLeft-b,this.offsetTop=this.offsetBaseTop-this.mirrorTop*(1-this.speed)):this.visibility="hidden";this.$mirror.css({transform:"translate3d("+this.mirrorLeft+"px, "+(this.mirrorTop-e)+"px, 0px)",visibility:this.visibility,height:this.boxHeight,width:this.boxWidth});this.$slider.css({transform:"translate3d("+this.offsetLeft+"px, "+this.offsetTop+"px, 0px)",position:"absolute",height:this.imageHeight,
width:this.imageWidth,maxWidth:"none"})}});e.extend(c,{scrollTop:0,scrollLeft:0,winHeight:0,winWidth:0,docHeight:1073741824,docWidth:1073741824,sliders:[],isReady:!1,isFresh:!1,isBusy:!1,setup:function(){function a(){if(m==g.pageYOffset)return g.requestAnimationFrame(a),!1;m=g.pageYOffset;b.render();g.requestAnimationFrame(a)}if(!this.isReady){var b=this,f=e(k),d=e(g),h=function(){c.winHeight=d.height();c.winWidth=d.width();c.docHeight=f.height();c.docWidth=f.width()},l=function(){var a=d.scrollTop(),
b=c.docHeight-c.winHeight,e=c.docWidth-c.winWidth;c.scrollTop=Math.max(0,Math.min(b,a));c.scrollLeft=Math.max(0,Math.min(e,d.scrollLeft()));c.overScroll=Math.max(a-b,Math.min(a,0))};d.on("resize.px.parallax load.px.parallax",function(){h();b.refresh();c.isFresh=!1;c.requestRender()}).on("scroll.px.parallax load.px.parallax",function(){l();c.requestRender()});h();l();this.isReady=!0;var m=-1;a()}},configure:function(a){"object"==typeof a&&(delete a.refresh,delete a.render,e.extend(this.prototype,a))},
refresh:function(){e.each(this.sliders,function(){this.refresh()});this.isFresh=!0},render:function(){this.isFresh||this.refresh();e.each(this.sliders,function(){this.render()})},requestRender:function(){this.render();this.isBusy=!1},destroy:function(a){var b,f=e(a).data("px.parallax");f.$mirror.remove();for(b=0;b<this.sliders.length;b+=1)this.sliders[b]==f&&this.sliders.splice(b,1);e(a).data("px.parallax",!1);0===this.sliders.length&&(e(g).off("scroll.px.parallax resize.px.parallax load.px.parallax"),
this.isReady=!1,c.isSetup=!1)}});var n=e.fn.parallax;e.fn.parallax=function(a){return this.each(function(){var b=e(this),f="object"==typeof a&&a;this==g||this==k||b.is("body")?c.configure(f):b.data("px.parallax")?"object"==typeof a&&e.extend(b.data("px.parallax"),f):(f=e.extend({},b.data(),f),b.data("px.parallax",new c(this,f)));if("string"==typeof a)if("destroy"==a)c.destroy(this);else c[a]()})};e.fn.parallax.Constructor=c;e.fn.parallax.noConflict=function(){e.fn.parallax=n;return this};e(function(){e('[data-parallax="scroll"]').parallax()})})(jQuery,
window,document);