$(function(){ParallaxScroll.init()});var ParallaxScroll={showLogs:false,round:1000,init:function(){this._log("init");if(this._inited){this._log("Already Inited");this._inited=true;return}this._requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){window.setTimeout(a,1000/60)}})();this._onScroll(true)},_inited:false,_properties:["x","y","z","rotateX","rotateY","rotateZ","scaleX","scaleY","scaleZ","scale"],_requestAnimationFrame:null,_log:function(a){if(this.showLogs){console.log("Parallax Scroll / "+a)}},_onScroll:function(a){var b=$(document).scrollTop();var c=$(window).height();this._log("onScroll "+b);$("[data-parallax]").each($.proxy(function(p,n){var d=$(n);var r=[];var f=false;var z=d.data("style");if(z==undefined){z=d.attr("style")||"";d.data("style",z)}var j=[d.data("parallax")];var o;for(o=2;;o++){if(d.data("parallax"+o)){j.push(d.data("parallax-"+o))}else{break}}var k=j.length;for(o=0;o<k;o++){var i=j[o];var w=i["from-scroll"];if(w==undefined){w=Math.max(0,$(n).offset().top-c)}w=w|0;var v=i.distance;var x=i["to-scroll"];if(v==undefined&&x==undefined){v=c}v=Math.max(v|0,1);var l=i.easing;var m=i["easing-return"];if(l==undefined||!$.easing||!$.easing[l]){l=null}if(m==undefined||!$.easing||!$.easing[m]){m=l}if(l){var A=i.duration;if(A==undefined){A=v}A=Math.max(A|0,1);var B=i["duration-return"];if(B==undefined){B=A}v=1;var h=d.data("current-time");if(h==undefined){h=0}}if(x==undefined){x=w+v}x=x|0;var y=i.smoothness;if(y==undefined){y=30}y=y|0;if(a||y==0){y=1}y=y|0;var u=b;u=Math.max(u,w);u=Math.min(u,x);if(l){if(d.data("sens")==undefined){d.data("sens","back")}if(u>w){if(d.data("sens")=="back"){h=1;d.data("sens","go")}else{h++}}if(u<x){if(d.data("sens")=="go"){h=1;d.data("sens","back")}else{h++}}if(a){h=A}d.data("current-time",h)}this._properties.map($.proxy(function(H){var D=0;var I=i[H];if(I==undefined){return}if(H=="scale"||H=="scaleX"||H=="scaleY"||H=="scaleZ"){D=1}else{I=I|0}var G=d.data("_"+H);if(G==undefined){G=D}var F=((I-D)*((u-w)/(x-w)))+D;var J=G+(F-G)/y;if(l&&h>0&&h<=A){var E=D;if(d.data("sens")=="back"){E=I;I=-I;l=m;A=B}J=$.easing[l](null,h,E,I,A)}J=Math.ceil(J*this.round)/this.round;if(J==G&&F==I){J=I}if(!r[H]){r[H]=0}r[H]+=J;if(G!=r[H]){d.data("_"+H,r[H]);f=true}},this))}if(f){if(r.z!=undefined){var q=i.perspective;if(q==undefined){q=800}var e=d.parent();if(!e.data("style")){e.data("style",e.attr("style")||"")}e.attr("style","perspective:"+q+"px; -webkit-perspective:"+q+"px; "+e.data("style"))}if(r.scaleX==undefined){r.scaleX=1}if(r.scaleY==undefined){r.scaleY=1}if(r.scaleZ==undefined){r.scaleZ=1}if(r.scale!=undefined){r.scaleX*=r.scale;r.scaleY*=r.scale;r.scaleZ*=r.scale}var C="translate3d("+(r.x?r.x:0)+"px, "+(r.y?r.y:0)+"px, "+(r.z?r.z:0)+"px)";var s="rotateX("+(r.rotateX?r.rotateX:0)+"deg) rotateY("+(r.rotateY?r.rotateY:0)+"deg) rotateZ("+(r.rotateZ?r.rotateZ:0)+"deg)";var t="scaleX("+r.scaleX+") scaleY("+r.scaleY+") scaleZ("+r.scaleZ+")";var g=C+" "+s+" "+t+";";this._log(g);d.attr("style","transform:"+g+" -webkit-transform:"+g+" "+z)}},this));if(window.requestAnimationFrame){window.requestAnimationFrame($.proxy(this._onScroll,this,false))}else{this._requestAnimationFrame($.proxy(this._onScroll,this,false))}}};