// ZIM js Interactive Media modules by Dan Zen http://danzen.com (c) 2016
// http://zimjs.com
// zimframe.js provides code to help you set up your coding environment
// free to use - donations welcome of course! http://zimjs.com/donate
if("undefined"==typeof zog)document.write(''),document.write('');else var zim=function(e){return zon&&zog("ZIM FRAME Module"),e.windowWidth=function(){return isNaN(window.innerWidth)?window.clientWidth:window.innerWidth},e.windowHeight=function(){return isNaN(window.innerHeight)?window.clientHeight:window.innerHeight},e.Frame=function(t,n,i,o,r,s){function a(){function a(){c(),d(),s&&setTimeout(function(){window.scrollTo(0,0)},100),p.dispatchEvent("ready"),"full"==t&&(g=!0,u())}function d(){"none"!=t&&l(),"full"==t&&(p.zil=zil()),w=new createjs.Stage("myCanvas"),w.setBounds(0,0,v,z),o&&w.enableMouseOver(10),r&&createjs.Touch.enable(w,!0)}function u(){g&&p.dispatchEvent("resize")}function l(){var n,i,o=zid("myCanvas"),r=e.windowWidth(),s=e.windowHeight();if(f=p.orientation=r>s?"horizontal":"vertical",f!=m&&(m=f,p.dispatchEvent("orientation")),o){if("fit"==t)r/s>=v/z?(i=s,n=i*v/z):(n=r,i=n*z/v);else if("outside"==t)document.body.style.overflow="hidden",r/s>=v/z?(n=r,i=n*z/v):(i=s,n=i*v/z);else if("full"==t)return document.body.style.overflow="hidden",o.style.left=o.style.top="0px",v=r,z=s,w&&w.setBounds(0,0,v,z),void u();o.style.width=n+"px",o.style.height=i+"px",o.style.left=(r-n)/2+"px",o.style.top=(s-i)/2+"px"}}function c(){var e=document.createElement("canvas");e.setAttribute("id","myCanvas"),h=Math.max(window.innerWidth,screen.width,window.innerHeight,screen.height),"full"==t?(e.setAttribute("width",h),e.setAttribute("height",h)):(e.setAttribute("width",v),e.setAttribute("height",z)),document.body.appendChild(e)}zot(t)&&(t="full"),zot(n)&&(n=500),zot(i)&&(i=500),zot(o)&&(o=!0),zot(r)&&(r=!0),zot(s)&&(s=!0);var h,f,m,w,p=this,v=n,z=i,g=!1;window.addEventListener("load",a),"none"!=t&&window.addEventListener("resize",l),Object.defineProperty(p,"stage",{get:function(){return w},set:function(e){zog("zim.Frame(): stage is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(p,"stageW",{get:function(){return v},set:function(e){zog("zim.Frame(): stageW is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(p,"stageH",{get:function(){return z},set:function(e){zog("zim.Frame(): stageH is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(p,"width",{get:function(){return v},set:function(e){zog("zim.Frame(): width is read only - see remakeCanvas(), perhaps")}}),Object.defineProperty(p,"height",{get:function(){return z},set:function(e){zog("zim.Frame(): height is read only - see remakeCanvas(), perhaps")}}),this.remakeCanvas=function(e,n){"full"!=t&&(zot(e)&&(e=v),zot(n)&&(n=z),zid("myCanvas")&&zid("myCanvas").parentNode.removeChild(zid("myCanvas")),v=e,z=n,c(),d())},this.dispose=function(){window.removeEventListener("resize",l),w.removeAllChildren(),w.removeAllEventListeners(),zid("myCanvas")&&zid("myCanvas").parentNode.removeChild(zid("myCanvas")),w=null,p=null}}var d,u="scaling, width, height, rollover, touch, scrollTop";return(d=zob(e.Frame,arguments,u))?d:(a.prototype=new createjs.EventDispatcher,a.prototype.constructor=e.Frame,new a)},e}(zim||{});