// ZIM js Interactive Media modules by Dan Zen http://danzen.com (c) 2016
// zimparallax.js comes from the ZIM Build module at http://zimjs.com
// free to use - donations welcome of course! http://zimjs.com/donate
// classes in this module require createjs namespace to exist and in particular easel.js
// available at http://createjs.com
// (borrows zim.ProportionDamp from ZIM code)
if("undefined"==typeof zog)document.write(''),document.write('');else var zim=function(t){return zon&&zog("ZIM PARALLAX Sub Module"),t.ProportionDamp=function(o,r,e,p,i,n,a){function s(){isNaN(d)||(d=Math.max(d,o),d=Math.min(d,r),l=(d-o)/(r-o),f=p-e,m=n>0?e+f*l:p-f*l,g=m,z=g-v,v+=z*h.damp)}var u,c="baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound";if(u=zob(t.ProportionDamp,arguments,c))return u;zot(e)&&(e=0),zot(p)&&(p=1),zot(i)&&(i=.1),zot(n)&&(n=1),zot(a)&&(a=!1),this.damp=i;var d,l,f,m,z,h=this,g=0,v=0;d=o,v=e;var b=setInterval(s,20);this.immediate=function(t){h.convert(t),s(),v=m,a&&(v=Math.round(v))},this.convert=function(t){return d=t,a?Math.round(v):v},this.dispose=function(){clearInterval(b)}},t.Parallax=function(o,r,e,p,i,n){function a(t){d.step()}var s,u="stage, damp, layers, auto, fps, ticker";if(s=zob(t.Parallax,arguments,u,this))return s;if(zon&&zog("zim build - Parallax"),zot(o)||!o.getBounds)return void zog("zim build - Parallax(): please pass in the stage with bounds as first parameter");if(!o.getBounds())return void zog("zim build - Parallax(): Please give the stage bounds using setBounds()");zot(p)&&(p=!0),zot(i)&&(i=30),zot(n)&&(n=!0);var c=o.getBounds().width,d=(o.getBounds().height,this);this.damp=zot(r)?.1:r,this.addLayer=function(o){if(!(zot(o.obj)||zot(o.prop)||zot(o.propChange))){var r={obj:o.obj,prop:o.prop};r[r.prop]=o.propChange,zot(o.input)&&(o.input="mouseX"),r.input=o.input;var e=zot(o.inMin)?0:o.inMin,p=zot(o.inMax)?c:o.inMax,i=zot(o.factor)?1:o.factor,n=zot(o.integer)?!1:o.integer;return r["p_"+r.prop]=new t.ProportionDamp(e,p,0,r[r.prop],d.damp,i,n),"scale"==r.prop?r["s_"+r.prop]=r.obj.scaleX:"frame"==r.prop?r["s_"+r.prop]=r.obj.currentFrame:r["s_"+r.prop]=r.obj[r.prop],l.push(r),l.length-1}},this.removeLayer=function(t){if(!zot(t)){var o=l[t];o["p_"+o.prop].dispose(),l.splice(t,1)}},this.immediate=function(t){for(var o,r=0;r