text: //============================================================
  //
  // The MIT License
  //
  // Copyright (C) 2013 Christophe Rosset - @topheman
  // Copyright (C) 2013 Matthew Wagerfield - @mwagerfield
  //
  // Permission is hereby granted, free of charge, to any
  // person obtaining a copy of this software and associated
  // documentation files (the "Software"), to deal in the
  // Software without restriction, including without limitation
  // the rights to use, copy, modify, merge, publish, distribute,
  // sublicense, and/or sell copies of the Software, and to
  // permit persons to whom the Software is furnished to do
  // so, subject to the following conditions:
  //
  // The above copyright notice and this permission notice
  // shall be included in all copies or substantial portions
  // of the Software.
  //
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
  // OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
  // EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  // OR OTHER DEALINGS IN THE SOFTWARE.
  //
  //============================================================
  (function(t,e,i){function a(t,e){this.element=t,this.layers=t.getElementsByClassName("layer");var i={calibrateX:this.data(this.element,"calibrate-x"),calibrateY:this.data(this.element,"calibrate-y"),invertX:this.data(this.element,"invert-x"),invertY:this.data(this.element,"invert-y"),limitX:this.data(this.element,"limit-x"),limitY:this.data(this.element,"limit-y"),scalarX:this.data(this.element,"scalar-x"),scalarY:this.data(this.element,"scalar-y"),frictionX:this.data(this.element,"friction-x"),frictionY:this.data(this.element,"friction-y"),headtrackr:this.data(this.element,"headtrackr"),headtrackrPreferDeviceMotion:this.data(this.element,"headtrackr-prefer-device-motion"),headtrackrDisplayVideo:this.data(this.element,"headtrackr-display-video"),headtrackrDebugView:this.data(this.element,"headtrackr-debug-view"),headtrackrScalarX:this.data(this.element,"headtrackr-scalar-x"),headtrackrScalarY:this.data(this.element,"headtrackr-scalar-y"),headtrackrScriptLocation:this.data(this.element,"headtrackr-script-location")};for(var a in i)null===i[a]&&delete i[a];this.extend(this,n,e,i),this.calibrationTimer=null,this.calibrationFlag=!0,this.enabled=!1,this.depths=[],this.raf=null,this.ox=0,this.oy=0,this.ow=0,this.oh=0,this.cx=0,this.cy=0,this.ix=0,this.iy=0,this.mx=0,this.my=0,this.vx=0,this.vy=0,this.onFaceTracking=this.onFaceTracking.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onDeviceOrientation=this.onDeviceOrientation.bind(this),this.onOrientationTimer=this.onOrientationTimer.bind(this),this.onCalibrationTimer=this.onCalibrationTimer.bind(this),this.onAnimationFrame=this.onAnimationFrame.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.initialise()}var r="Parallax",s=30,n={calibrationThreshold:100,calibrationDelay:500,supportDelay:500,calibrateX:!1,calibrateY:!0,invertX:!0,invertY:!0,limitX:!1,limitY:!1,scalarX:10,scalarY:10,frictionX:.1,frictionY:.1,headtrackr:!1,headtrackrPreferDeviceMotion:!0,headtrackrDisplayVideo:!1,headtrackrDebugView:!1,headtrackrScalarX:3,headtrackrScalarY:3,headtrackrScriptLocation:null};a.prototype.extend=function(){if(arguments.length>1)for(var t=arguments[0],e=1,i=arguments.length;i>e;e++){var a=arguments[e];for(var r in a)t[r]=a[r]}},a.prototype.data=function(t,e){return this.deserialize(t.getAttribute("data-"+e))},a.prototype.deserialize=function(t){return"true"===t?!0:"false"===t?!1:"null"===t?null:!isNaN(parseFloat(t))&&isFinite(t)?parseFloat(t):t},a.prototype.offset=function(t){for(var e=0,i=0;t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop);)e+=t.offsetLeft-t.scrollLeft,i+=t.offsetTop-t.scrollTop,t=t.offsetParent;return{top:i,left:e}},a.prototype.camelCase=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},a.prototype.transformSupport=function(a){for(var r=e.createElement("div"),s=!1,n=null,o=!1,h=null,l=null,c=0,d=this.vendors.length;d>c;c++)if(null!==this.vendors[c]?(h=this.vendors[c][0]+"transform",l=this.vendors[c][1]+"Transform"):(h="transform",l="transform"),r.style[l]!==i){s=!0;break}switch(a){case"2D":o=s;break;case"3D":s&&(e.body.appendChild(r),r.style[l]="translate3d(1px,1px,1px)",n=t.getComputedStyle(r).getPropertyValue(h),o=n!==i&&n.length>0&&"none"!==n,e.body.removeChild(r))}return o},a.prototype.ww=null,a.prototype.wh=null,a.prototype.hw=null,a.prototype.hh=null,a.prototype.portrait=null,a.prototype.desktop=!navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i),a.prototype.vendors=[null,["-webkit-","webkit"],["-moz-","Moz"],["-o-","O"],["-ms-","ms"]],a.prototype.motionSupport=!!t.DeviceMotionEvent,a.prototype.orientationSupport=!!t.DeviceOrientationEvent,a.prototype.getUserMediaSupport=!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia),a.prototype.headtrackrEnabled=!1,a.prototype.orientationStatus=0,a.prototype.transform2DSupport=a.prototype.transformSupport("2D"),a.prototype.transform3DSupport=a.prototype.transformSupport("3D"),a.prototype.headtrackrPrepare=function(){if("undefined"==typeof headtrackr){if(null!==this.headtrackrScriptLocation){var i=e.createElement("script"),a=this;return i.onload=function(){if("undefined"==typeof headtrackr)throw Error("Wrong path to headtrackr script");a.headtrackrPrepare()},i.src=this.headtrackrScriptLocation,e.getElementsByTagName("body")[0].appendChild(i),!1}throw Error("To use the headtrackr feature, you need to include the headtrakr.js or headtrackr.min.js script before the parallax one, or set its location in the parallax option headtrackrScriptLocation")}var a,r=e.createElement("video"),s=e.createElement("canvas"),n=null,o="320",h="240",l={};t.addEventListener("mousemove",this.onMouseMove),r.autoplay=!0,r.loop=!0,r.style.display="none",r.width=o,r.height=h,s.id="headtrackr-display-video",s.style.position="fixed",s.style.bottom="0px",s.style.right="0px",s.width=o,s.height=h,this.headtrackrDisplayVideo===!0||this.headtrackrDebugView===!0?(s.style.display="block",this.headtrackrDebugView===!0&&(n=e.createElement("canvas"),n.id="headtrackr-debug-view",n.style.display="block",n.style.position="fixed",n.style.bottom="0px",n.style.right="0px",n.width=o,n.height=h,l.calcAngles=!0)):(this.headtrackrDebugView=!1,s.style.display="none"),this.htrackr=new headtrackr.Tracker(l),e.getElementsByTagName("body")[0].appendChild(r),e.getElementsByTagName("body")[0].appendChild(s),null!==n&&(e.getElementsByTagName("body")[0].appendChild(n),this.htrackr.canvasDebug=n,this.htrackr.ctxDebug=n.getContext("2d")),"function"==typeof this.headtrackrOnBeforeCameraAccess&&this.headtrackrOnBeforeCameraAccess(),this.htrackr.init(r,s),this.htrackr.start(),this.htrackr.canvasInputInfos={ww:s.width,wh:s.height,hw:s.width/2,hh:s.height/2},a=this,e.addEventListener("headtrackrStatus",function(i){console.log(i.status,i.type,i.timeStamp),"camera found"===i.status?"function"==typeof a.headtrackrOnCameraFound&&a.headtrackrOnCameraFound():"found"===i.status?(t.removeEventListener("mousemove",a.onMouseMove),e.addEventListener("facetrackingEvent",a.onFaceTracking,!1)):"redetecting"===i.status&&(t.addEventListener("mousemove",a.onMouseMove),e.removeEventListener("facetrackingEvent",a.onFaceTracking,!1))})},a.prototype.headtrackrFail=function(){"function"!=typeof this.headtrackrNoGetUserMediaCallback&&(this.headtrackrNoGetUserMediaCallback=function(){var t="<small>Sorry no getUserMedia support on your browser.</small><br><br>To test <strong>facetracking</strong>,<br><br>please use<br><strong>Chrome or Firefox</strong>";console.log(t.replace(/<br>/g," ").replace(/(<([^>]+)>)/gi,""));var i=1e4,a=e.createElement("div"),r=e.createElement("div"),s=e.createElement("p");a.setAttribute("id","headtrackerMessageDiv"),a.style.left="10%",a.style.right="10%",a.style.top="10%",a.style.fontSize="150%",a.style.color="#777",a.style.position="absolute",a.style.fontFamily="Helvetica, Arial, sans-serif",a.style.zIndex="100002",r.style.marginLeft="auto",r.style.marginRight="auto",r.style.width="100%",r.style.textAlign="center",r.style.color="#fff",r.style.backgroundColor="#444",r.style.opacity="0.8",s.setAttribute("id","parallaxHeadtrackerNoGetUserMediaMessage"),s.innerHTML=t,r.appendChild(s),a.appendChild(r),e.body.appendChild(a),setTimeout(function(){a.parentNode.removeChild(a)},i)}),this.headtrackrNoGetUserMediaCallback(),this.headtrackr=!1},a.prototype.initialise=function(){this.transform3DSupport&&this.accelerate(this.element);var e=t.getComputedStyle(this.element);"static"===e.getPropertyValue("position")&&(this.element.style.position="relative");for(var i=0,a=this.layers.length;a>i;i++){var r=this.layers[i];this.transform3DSupport&&this.accelerate(r),r.style.position=i?"absolute":"relative",r.style.display="block",r.style.height="100%",r.style.width="100%",r.style.left=0,r.style.top=0,this.depths.push(this.data(r,"depth")||0)}this.headtrackr!==!0||this.getUserMediaSupport!==!0||this.headtrackrPreferDeviceMotion!==!1&&this.orientationSupport!==!1||this.headtrackrEnabled!==!1?this.headtrackr!==!0||this.getUserMediaSupport!==!1||this.headtrackrPreferDeviceMotion!==!1&&this.orientationSupport!==!1||this.headtrackrEnabled!==!1||this.headtrackrFail():(this.headtrackrPrepare(),this.headtrackrEnabled=!0),this.updateDimensions(),this.enable(),this.queueCalibration(this.calibrationDelay)},a.prototype.updateDimensions=function(){this.ox=this.offset(this.element).left,this.oy=this.offset(this.element).top,this.ow=this.element.offsetWidth,this.oh=this.element.offsetHeight,this.ww=t.innerWidth,this.wh=t.innerHeight,this.hw=this.ww/2,this.hh=this.wh/2},a.prototype.queueCalibration=function(t){clearTimeout(this.calibrationTimer),this.calibrationTimer=setTimeout(this.onCalibrationTimer,t)},a.prototype.enable=function(){this.enabled||(this.enabled=!0,this.headtrackrEnabled===!1&&this.orientationSupport?(this.portrait=null,t.addEventListener("deviceorientation",this.onDeviceOrientation),setTimeout(this.onOrientationTimer,this.supportDelay)):this.headtrackrEnabled===!1?(this.cx=0,this.cy=0,this.portrait=!1,t.addEventListener("mousemove",this.onMouseMove)):e.addEventListener("facetrackingEvent",this.onFaceTracking,!1),t.addEventListener("resize",this.onWindowResize),this.raf=requestAnimationFrame(this.onAnimationFrame))},a.prototype.disable=function(){this.enabled&&(this.enabled=!1,this.headtrackrEnabled===!1&&this.orientationSupport?t.removeEventListener("deviceorientation",this.onDeviceOrientation):this.headtrackrEnabled===!1?t.removeEventListener("mousemove",this.onMouseMove):e.removeEventListener("facetrackingEvent",this.onFaceTracking,!1),t.removeEventListener("resize",this.onWindowResize),cancelAnimationFrame(this.raf))},a.prototype.calibrate=function(t,e){this.calibrateX=t===i?this.calibrateX:t,this.calibrateY=e===i?this.calibrateY:e},a.prototype.invert=function(t,e){this.invertX=t===i?this.invertX:t,this.invertY=e===i?this.invertY:e},a.prototype.friction=function(t,e){this.frictionX=t===i?this.frictionX:t,this.frictionY=e===i?this.frictionY:e},a.prototype.scalar=function(t,e){this.scalarX=t===i?this.scalarX:t,this.scalarY=e===i?this.scalarY:e},a.prototype.headtrackrScalar=function(t,e){this.headtrackrScalarX=t===i?this.headtrackrScalarX:t,this.headtrackrScalarY=e===i?this.headtrackrScalarY:e},a.prototype.limit=function(t,e){this.limitX=t===i?this.limitX:t,this.limitY=e===i?this.limitY:e},a.prototype.clamp=function(t,e,i){return t=Math.max(t,e),t=Math.min(t,i)},a.prototype.css=function(t,e,a){for(var r=null,s=0,n=this.vendors.length;n>s;s++)if(r=null!==this.vendors[s]?this.camelCase(this.vendors[s][1]+"-"+e):e,t.style[r]!==i){t.style[r]=a;break}},a.prototype.accelerate=function(t){this.css(t,"transform","translate3d(0,0,0)"),this.css(t,"transform-style","preserve-3d"),this.css(t,"backface-visibility","hidden")},a.prototype.setPosition=function(t,e,i){e+="%",i+="%",this.transform3DSupport?this.css(t,"transform","translate3d("+e+","+i+",0)"):this.transform2DSupport?this.css(t,"transform","translate("+e+","+i+")"):(t.style.left=e,t.style.top=i)},a.prototype.onOrientationTimer=function(){this.orientationSupport&&0===this.orientationStatus&&(this.disable(),this.orientationSupport=!1,this.headtrackr===!0&&this.getUserMediaSupport===!0&&this.headtrackrPreferDeviceMotion===!0&&this.headtrackrEnabled===!1?(this.headtrackrPrepare(),this.headtrackrEnabled=!0):this.headtrackr===!0&&this.getUserMediaSupport===!1&&this.headtrackrPreferDeviceMotion===!0&&this.headtrackrEnabled===!1&&this.headtrackrFail(),this.enable())},a.prototype.onCalibrationTimer=function(){this.calibrationFlag=!0},a.prototype.onWindowResize=function(){this.updateDimensions()},a.prototype.onAnimationFrame=function(){var t=this.ix-this.cx,e=this.iy-this.cy;(Math.abs(t)>this.calibrationThreshold||Math.abs(e)>this.calibrationThreshold)&&this.queueCalibration(0),this.portrait?(this.mx=(this.calibrateX?e:this.iy)*this.scalarX,this.my=(this.calibrateY?t:this.ix)*this.scalarY):(this.mx=(this.calibrateX?t:this.ix)*this.scalarX,this.my=(this.calibrateY?e:this.iy)*this.scalarY),isNaN(parseFloat(this.limitX))||(this.mx=this.clamp(this.mx,-this.limitX,this.limitX)),isNaN(parseFloat(this.limitY))||(this.my=this.clamp(this.my,-this.limitY,this.limitY)),this.vx+=(this.mx-this.vx)*this.frictionX,this.vy+=(this.my-this.vy)*this.frictionY;for(var i=0,a=this.layers.length;a>i;i++){var r=this.layers[i],s=this.depths[i],n=this.vx*s*(this.invertX?-1:1),o=this.vy*s*(this.invertY?-1:1);this.setPosition(r,n,o)}this.raf=requestAnimationFrame(this.onAnimationFrame)},a.prototype.onDeviceOrientation=function(t){if(!this.desktop&&null!==t.beta&&null!==t.gamma){this.orientationStatus=1;var e=(t.beta||0)/s,i=(t.gamma||0)/s,a=this.wh>this.ww;this.portrait!==a&&(this.portrait=a,this.calibrationFlag=!0),this.calibrationFlag&&(this.calibrationFlag=!1,this.cx=e,this.cy=i),this.ix=e,this.iy=i}},a.prototype.onMouseMove=function(t){this.ix=(t.pageX-this.hw)/this.hw,this.iy=(t.pageY-this.hh)/this.hh},a.prototype.onFaceTracking=function(t){"CS"===t.detection&&(this.ix=-this.headtrackrScalarX*(t.x-this.htrackr.canvasInputInfos.hw)/this.htrackr.canvasInputInfos.hw,this.iy=this.headtrackrScalarY*(t.y-this.htrackr.canvasInputInfos.hh)/this.htrackr.canvasInputInfos.hh,this.headtrackrDebugView===!0&&(this.htrackr.canvasDebug.width=this.htrackr.canvasDebug.width,this.htrackr.ctxDebug.translate(t.x,t.y),this.htrackr.ctxDebug.rotate(t.angle-Math.PI/2),this.htrackr.ctxDebug.strokeStyle="#00CC00",this.htrackr.ctxDebug.strokeRect(-(t.width/2)>>0,-(t.height/2)>>0,t.width,t.height),this.htrackr.ctxDebug.rotate(Math.PI/2-t.angle),this.htrackr.ctxDebug.translate(-t.x,-t.y)))},t[r]=a})(window,document),function(){for(var t=0,e=["ms","moz","webkit","o"],i=0;e.length>i&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var i=(new Date).getTime(),a=Math.max(0,16-(i-t)),r=window.setTimeout(function(){e(i+a)},a);return t=i+a,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();