;(function($,window,document,undefined){(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x').prependTo('body');var slider=this.$element.find('>.parallax-slider');var sliderExisted=false;if(slider.length==0)this.$slider=$('').prependTo(this.$mirror);else{this.$slider=slider.prependTo(this.$mirror) sliderExisted=true;}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(){if(!self.naturalHeight||!self.naturalWidth){self.naturalHeight=this.naturalHeight||this.height||1;self.naturalWidth=this.naturalWidth||this.width||1;}self.aspectRatio=self.naturalWidth/self.naturalHeight;Parallax.isSetup||Parallax.setup();Parallax.sliders.push(self);Parallax.isFresh=false;Parallax.requestRender();});if(!sliderExisted)this.$slider[0].src=this.imageSrc;if(this.naturalHeight&&this.naturalWidth||this.$slider[0].complete||slider.length>0){this.$slider.trigger('load');}};$.extend(Parallax.prototype,{speed:0.2,bleed:0,zIndex:-100,iosFix:true,androidFix:true,position:'center',overScrollFix:false,refresh:function(){this.boxWidth=this.$element.outerWidth();this.boxHeight=this.$element.outerHeight()+this.bleed*2;this.boxOffsetTop=this.$element.offset().top-this.bleed;this.boxOffsetLeft=this.$element.offset().left;this.boxOffsetBottom=this.boxOffsetTop+this.boxHeight;var winHeight=Parallax.winHeight;var docHeight=Parallax.docHeight;var maxOffset=Math.min(this.boxOffsetTop,docHeight-winHeight);var minOffset=Math.max(this.boxOffsetTop+this.boxHeight-winHeight,0);var imageHeightMin=this.boxHeight+(maxOffset-minOffset)*(1-this.speed)|0;var imageOffsetMin=(this.boxOffsetTop-maxOffset)*(1-this.speed)|0;if(imageHeightMin*this.aspectRatio>=this.boxWidth){this.imageWidth=imageHeightMin*this.aspectRatio|0;this.imageHeight=imageHeightMin;this.offsetBaseTop=imageOffsetMin;var margin=this.imageWidth-this.boxWidth;if(this.positionX=='left'){this.offsetLeft=0;}else if(this.positionX=='right'){this.offsetLeft=-margin;}else if(!isNaN(this.positionX)){this.offsetLeft=Math.max(this.positionX,-margin);}else{this.offsetLeft=-margin/2|0;}}else{this.imageWidth=this.boxWidth;this.imageHeight=this.boxWidth/this.aspectRatio|0;this.offsetLeft=0;var margin=this.imageHeight-imageHeightMin;if(this.positionY=='top'){this.offsetBaseTop=imageOffsetMin;}else if(this.positionY=='bottom'){this.offsetBaseTop=imageOffsetMin-margin;}else if(!isNaN(this.positionY)){this.offsetBaseTop=imageOffsetMin+Math.max(this.positionY,-margin);}else{this.offsetBaseTop=imageOffsetMin-margin/2|0;}}},render:function(){var scrollTop=Parallax.scrollTop;var scrollLeft=Parallax.scrollLeft;var overScroll=this.overScrollFix?Parallax.overScroll:0;var scrollBottom=scrollTop+Parallax.winHeight;if(this.boxOffsetBottom>scrollTop&&this.boxOffsetTop<=scrollBottom){this.visibility='visible';this.mirrorTop=this.boxOffsetTop-scrollTop;this.mirrorLeft=this.boxOffsetLeft-scrollLeft;this.offsetTop=this.offsetBaseTop-this.mirrorTop*(1-this.speed);}else{this.visibility='hidden';}this.$mirror.css({transform:'translate3d(0px, 0px, 0px)',visibility:this.visibility,top:this.mirrorTop-overScroll,left:this.mirrorLeft,height:this.boxHeight,width:this.boxWidth});this.$slider.css({transform:'translate3d(0px, 0px, 0px)',position:'absolute',top:this.offsetTop,left:this.offsetLeft,height:this.imageHeight,width:this.imageWidth,maxWidth:'none'});}});$.extend(Parallax,{scrollTop:0,scrollLeft:0,winHeight:0,winWidth:0,docHeight:1<<30,docWidth:1<<30,sliders:[],isReady:false,isFresh:false,isBusy:false,setup:function(){if(this.isReady)return;var $doc=$(document),$win=$(window);var loadDimensions=function(){Parallax.winHeight=$win.height();Parallax.winWidth=$win.width();Parallax.docHeight=$doc.height();Parallax.docWidth=$doc.width();};var loadScrollPosition=function(){var winScrollTop=$win.scrollTop();var scrollTopMax=Parallax.docHeight-Parallax.winHeight;var scrollLeftMax=Parallax.docWidth-Parallax.winWidth;Parallax.scrollTop=Math.max(0,Math.min(scrollTopMax,winScrollTop));Parallax.scrollLeft=Math.max(0,Math.min(scrollLeftMax,$win.scrollLeft()));Parallax.overScroll=Math.max(winScrollTop-scrollTopMax,Math.min(winScrollTop,0));};$win.on('resize.px.parallax load.px.parallax',function(){loadDimensions();Parallax.isFresh=false;Parallax.requestRender();}).on('scroll.px.parallax load.px.parallax',function(){loadScrollPosition();Parallax.requestRender();});loadDimensions();loadScrollPosition();this.isReady=true;},configure:function(options){if(typeof options=='object'){delete options.refresh;delete options.render;$.extend(this.prototype,options);}},refresh:function(){$.each(this.sliders,function(){this.refresh()});this.isFresh=true;},render:function(){this.isFresh||this.refresh();$.each(this.sliders,function(){this.render()});},requestRender:function(){var self=this;if(!this.isBusy){this.isBusy=true;window.requestAnimationFrame(function(){self.render();self.isBusy=false;});}},destroy:function(el){var i,parallaxElement=$(el).data('px.parallax');parallaxElement.$mirror.remove();for(i=0;i