text: /*
  Quark 1.0.0 (build 121)
  Licensed under the MIT License.
  http://github.com/quark-dev-team/quarkjs
  */
  
  (function(b){function a(a,c,d){for(var b=a.length,i=c.length,j,k,n,q,p,l={x:0,y:0},m=0;m<b;m++){j=a[m];k=a[m<b-1?m+1:0];l.x=j.y-k.y;l.y=k.x-j.x;j=Math.sqrt(l.x*l.x+l.y*l.y);l.x/=j;l.y/=j;j=k=a[0].x*l.x+a[0].y*l.y;for(var o=1;o<b;o++)p=a[o].x*l.x+a[o].y*l.y,p>k?k=p:p<j&&(j=p);n=q=c[0].x*l.x+c[0].y*l.y;for(o=1;o<i;o++)p=c[o].x*l.x+c[o].y*l.y,p>q?q=p:p<n&&(n=p);j<n?(j=n-k,l.x=-l.x,l.y=-l.y):j-=q;if(j>=0)return!1;else if(j>d.overlap)d.overlap=j,d.normal.x=l.x,d.normal.y=l.y}return d}var c=b.Quark=b.Quark||
  {global:b},d=function(){};c.inherit=function(a,c){d.prototype=c.prototype;a.superClass=c.prototype;a.prototype=new d;a.prototype.constructor=a};c.merge=function(a,c,d){for(var b in c)if(!d||a.hasOwnProperty(b)||a[b]!==void 0)a[b]=c[b];return a};c.delegate=function(a,c){var d=c||b;if(arguments.length>2){var g=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.concat.apply(g,arguments);return a.apply(d,c)}}else return function(){return a.apply(d,arguments)}};c.getDOM=function(a){return document.getElementById(a)};
  c.createDOM=function(a,c){var d=document.createElement(a),b;for(b in c){var i=c[b];if(b=="style")for(var j in i)d.style[j]=i[j];else d[b]=i}return d};c.use=function(a){for(var a=a.split("."),c=b,d=0;d<a.length;d++)var g=a[d],c=c[g]||(c[g]={});return c};(function(a){var c=a.ua=navigator.userAgent;a.isWebKit=/webkit/i.test(c);a.isMozilla=/mozilla/i.test(c);a.isIE=/msie/i.test(c);a.isFirefox=/firefox/i.test(c);a.isChrome=/chrome/i.test(c);a.isSafari=/safari/i.test(c)&&!this.isChrome;a.isMobile=/mobile/i.test(c);
  a.isOpera=/opera/i.test(c);a.isIOS=/ios/i.test(c);a.isIpad=/ipad/i.test(c);a.isIpod=/ipod/i.test(c);a.isIphone=/iphone/i.test(c)&&!this.isIpod;a.isAndroid=/android/i.test(c);a.supportStorage="localStorage"in b;a.supportOrientation="orientation"in b;a.supportDeviceMotion="ondevicemotion"in b;a.supportTouch="ontouchstart"in b;a.supportCanvas=document.createElement("canvas").getContext!=null;a.cssPrefix=a.isWebKit?"webkit":a.isFirefox?"Moz":a.isOpera?"O":a.isIE?"ms":""})(c);c.getElementOffset=function(a){for(var c=
  a.offsetLeft,d=a.offsetTop;(a=a.offsetParent)&&a!=document.body&&a!=document;)c+=a.offsetLeft,d+=a.offsetTop;return{left:c,top:d}};c.createDOMDrawable=function(a,d){var b=a.tagName||"div",g=d.image,i=a.width||g&&g.width,j=a.height||g&&g.height,k=c.createDOM(b);if(a.id)k.id=a.id;k.style.position="absolute";k.style.left=(a.left||0)+"px";k.style.top=(a.top||0)+"px";k.style.width=i+"px";k.style.height=j+"px";if(b=="canvas")k.width=i,k.height=j,g&&(b=k.getContext("2d"),i=d.rect||[0,0,i,j],b.drawImage(g,
  i[0],i[1],i[2],i[3],a.x||0,a.y||0,a.width||i[2],a.height||i[3]));else if(k.style.opacity=a.alpha!=void 0?a.alpha:1,k.style.overflow="hidden",g&&g.src)k.style.backgroundImage="url("+g.src+")",k.style.backgroundPosition=-(a.rectX||0)+"px "+-(a.rectY||0)+"px";return k};c.DEG_TO_RAD=Math.PI/180;c.RAD_TO_DEG=180/Math.PI;c.hitTestPoint=function(a,c,d,b){var a=a.getBounds(),i=a.length,j=c>=a.x&&c<=a.x+a.width&&d>=a.y&&d<=a.y+a.height;if(j&&b){for(var b=0,j=!1,k,n,q,p,l=0;l<i;l++){var m=a[l],o=a[(l+1)%i];
  if(m.y==o.y&&d==m.y&&(m.x>o.x?(k=o.x,n=m.x):(k=m.x,n=o.x),c>=k&&c<=n)){j=!0;continue}m.y>o.y?(q=o.y,p=m.y):(q=m.y,p=o.y);d<q||d>p||(m=(d-m.y)*(o.x-m.x)/(o.y-m.y)+m.x,m>c?b++:m==c&&(j=!0))}if(j)return 0;else if(b%2==1)return 1;return-1}return j?1:-1};c.hitTestObject=function(a,d,b){a=a.getBounds();d=d.getBounds();return(a=a.x<=d.x+d.width&&d.x<=a.x+a.width&&a.y<=d.y+d.height&&d.y<=a.y+a.height)&&b?(a=c.polygonCollision(d,d),a!==!1):a};c.polygonCollision=function(c,d){var b=a(c,d,{overlap:-Infinity,
  normal:{x:0,y:0}});return b?a(d,c,b):!1};c.toString=function(){return"Quark"};c.trace=function(){var a=Array.prototype.slice.call(arguments);typeof console!="undefined"&&typeof console.log!="undefined"&&console.log(a.join(" "))};if(b.Q==void 0)b.Q=c;if(b.trace==void 0)b.trace=c.trace})(window);
  (function(){var b=Quark.Matrix=function(a,c,d,b,f,h){this.a=a;this.b=c;this.c=d;this.d=b;this.tx=f;this.ty=h};b.prototype.concat=function(a){var c=this.a,d=this.c,b=this.tx;this.a=c*a.a+this.b*a.c;this.b=c*a.b+this.b*a.d;this.c=d*a.a+this.d*a.c;this.d=d*a.b+this.d*a.d;this.tx=b*a.a+this.ty*a.c+a.tx;this.ty=b*a.b+this.ty*a.d+a.ty;return this};b.prototype.rotate=function(a){var c=Math.cos(a),a=Math.sin(a),d=this.a,b=this.c,f=this.tx;this.a=d*c-this.b*a;this.b=d*a+this.b*c;this.c=b*c-this.d*a;this.d=
  b*a+this.d*c;this.tx=f*c-this.ty*a;this.ty=f*a+this.ty*c;return this};b.prototype.scale=function(a,c){this.a*=a;this.d*=c;this.tx*=a;this.ty*=c;return this};b.prototype.translate=function(a,c){this.tx+=a;this.ty+=c;return this};b.prototype.identity=function(){this.a=this.d=1;this.b=this.c=this.tx=this.ty=0;return this};b.prototype.invert=function(){var a=this.a,c=this.b,d=this.c,b=this.d,f=this.tx,h=a*b-c*d;this.a=b/h;this.b=-c/h;this.c=-d/h;this.d=a/h;this.tx=(d*this.ty-b*f)/h;this.ty=-(a*this.ty-
  c*f)/h;return this};b.prototype.transformPoint=function(a,c,d){var b=a.x*this.a+a.y*this.c+this.tx,f=a.x*this.b+a.y*this.d+this.ty;c&&(b=b+0.5>>0,f=f+0.5>>0);if(d)return{x:b,y:f};a.x=b;a.y=f;return a};b.prototype.clone=function(){return new b(this.a,this.b,this.c,this.d,this.tx,this.ty)};b.prototype.toString=function(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}})();
  (function(){var b=Quark.Rectangle=function(a,c,d,b){this.x=a;this.y=c;this.width=d;this.height=b};b.prototype.intersects=function(a){return this.x<=a.x+a.width&&a.x<=this.x+this.width&&this.y<=a.y+a.height&&a.y<=this.y+this.height};b.prototype.intersection=function(a){var c=Math.max(this.x,a.x),d=Math.min(this.x+this.width,a.x+a.width);if(c<=d){var e=Math.max(this.y,a.y),a=Math.min(this.y+this.height,a.y+a.height);if(e<=a)return new b(c,e,d-c,a-e)}return null};b.prototype.union=function(a,c){var d=
  Math.min(this.x,a.x),e=Math.min(this.y,a.y),f=Math.max(this.x+this.width,a.x+a.width)-d,h=Math.max(this.y+this.height,a.y+a.height)-e;if(c)return new b(d,e,f,h);else this.x=d,this.y=e,this.width=f,this.height=h};b.prototype.containsPoint=function(a,c){return this.x<=a&&a<=this.x+this.width&&this.y<=c&&c<=this.y+this.height};b.prototype.clone=function(){return new b(this.x,this.y,this.width,this.height)};b.prototype.toString=function(){return"(x="+this.x+", y="+this.y+", width="+this.width+", height="+
  this.height+")"}})();
  (function(){Quark.KEY={MOUSE_LEFT:1,MOUSE_MID:2,MOUSE_RIGHT:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,
  CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123}})();
  (function(){var b=Quark.EventManager=function(){this.keyState={};this._evtHandlers={}};b.prototype.registerStage=function(a,c,d,b){this.register(a.context.canvas,c,{host:a,func:a.dispatchEvent},d,b)};b.prototype.unregisterStage=function(a,c){this.unregister(a.context.canvas,c,a.dispatchEvent)};b.prototype.register=function(a,c,d,b,f){if(d==null||typeof d=="function")d={host:null,func:d};for(var h={prevent:b,stop:f},g=this,b=function(a){g._onEvent(a,h,d)},f=0;f<c.length;f++){for(var i=c[f],j=this._evtHandlers[i]||
  (this._evtHandlers[i]=[]),k=0,n=!1;k<j.length;k++){var q=j[k];if(q.target==a&&q.callback.func==d.func){trace("duplicate callback");n=!0;break}}n||(j.push({target:a,callback:d,handler:b}),a.addEventListener(i,b,!1))}};b.prototype.unregister=function(a,c,d){for(var b=0;b<c.length;b++)for(var f=c[b],h=this._evtHandlers[f],g=0;g<h.length;g++){var i=h[g];if(i.target==a&&(i.callback.func==d||d==null)){a.removeEventListener(f,i.handler);h.splice(g,1);break}}};b.prototype._onEvent=function(a,c,d){var e=a,
  f=a.type;if(a.type.indexOf("touch")==0)e=a.touches&&a.touches.length>0?a.touches[0]:a.changedTouches&&a.changedTouches.length>0?a.changedTouches[0]:a,e.type=f,e.rawEvent=a;if(f=="keydown"||f=="keyup"||f=="keypress")this.keyState[a.keyCode]=f;d.func!=null&&d.func.call(d.host,e);b.stop(a,!c.prevent,!c.stop)};b.stop=function(a,c,d){c||a.preventDefault();d||(a.stopPropagation(),a.stopImmediatePropagation&&a.stopImmediatePropagation())}})();
  (function(){var b=Quark.EventDispatcher=function(){this._eventMap={}};b.prototype.addEventListener=function(a,c){var d=this._eventMap[a];d==null&&(d=this._eventMap[a]=[]);return d.indexOf(c)==-1?(d.push(c),!0):!1};b.prototype.removeEventListener=function(a,c){if(arguments.length==1)return this.removeEventListenerByType(a);var d=this._eventMap[a];if(d==null)return!1;for(var b=0;b<d.length;b++)if(d[b]===c)return d.splice(b,1),d.length==0&&delete this._eventMap[a],!0;return!1};b.prototype.removeEventListenerByType=
  function(a){return this._eventMap[a]!=null?(delete this._eventMap[a],!0):!1};b.prototype.removeAllEventListeners=function(){this._eventMap={}};b.prototype.dispatchEvent=function(a){var c=this._eventMap[a.type];if(c==null)return!1;if(!a.target)a.target=this;for(var c=c.slice(),b=0;b<c.length;b++){var e=c[b];typeof e=="function"&&e.call(this,a)}return!0};b.prototype.hasEventListener=function(a){a=this._eventMap[a];return a!=null&&a.length>0};b.prototype.on=b.prototype.addEventListener;b.prototype.un=
  b.prototype.removeEventListener;b.prototype.fire=b.prototype.dispatchEvent})();(function(){var b=Quark.Context=function(a){if(a.canvas==null)throw"Quark.Context Error: canvas is required.";this.canvas=null;Quark.merge(this,a)};b.prototype.startDraw=function(){};b.prototype.draw=function(){};b.prototype.endDraw=function(){};b.prototype.transform=function(){};b.prototype.remove=function(){}})();
  (function(){var b=Quark.CanvasContext=function(a){b.superClass.constructor.call(this,a);this.context=this.canvas.getContext("2d")};Quark.inherit(b,Quark.Context);b.prototype.startDraw=function(){this.context.save()};b.prototype.draw=function(a){if(!(a.parent!=null&&a.parent.mask!=null))if(a.mask!=null){var c=a.width,b=a.height,e=Q._helpContext,f=e.canvas,h=e.context;f.width=0;f.width=c;f.height=b;e.startDraw();a.mask._render(e);h.globalCompositeOperation="source-in";var g=a.mask;a.mask=null;if(a instanceof
  Quark.DisplayObjectContainer){var i=a._cache||Quark.cacheObject(a);h.drawImage(i,0,0,c,b,0,0,c,b)}else a.render(e);e.endDraw();a.mask=g;arguments[0]=f;this.context.drawImage.apply(this.context,arguments)}else a._cache!=null?this.context.drawImage(a._cache,0,0):a instanceof Quark.Graphics||a instanceof Quark.Text?a._draw(this.context):(c=a.getDrawable(this),c!=null&&(arguments[0]=c,this.context.drawImage.apply(this.context,arguments)))};b.prototype.endDraw=function(){this.context.restore()};b.prototype.transform=
  function(a){var c=this.context;if(a instanceof Q.Stage){if(a._scaleX!=a.scaleX)a._scaleX=a.scaleX,this.canvas.style.width=a._scaleX*a.width+"px";if(a._scaleY!=a.scaleY)a._scaleY=a.scaleY,this.canvas.style.height=a._scaleY*a.height+"px"}else(a.x!=0||a.y!=0)&&c.translate(a.x,a.y),a.rotation%360!=0&&c.rotate(a.rotation%360*Quark.DEG_TO_RAD),(a.scaleX!=1||a.scaleY!=1)&&c.scale(a.scaleX,a.scaleY),(a.regX!=0||a.regY!=0)&&c.translate(-a.regX,-a.regY);a.alpha>0&&(c.globalAlpha*=a.alpha)};b.prototype.clear=
  function(a,c,b,e){this.context.clearRect(a,c,b,e)}})();
  (function(){function b(a,c){var b="";b+=c?"translate3d("+(a.x-a.regX)+"px, "+(a.y-a.regY)+"px, 0px)rotate3d(0, 0, 1, "+a.rotation+"deg)scale3d("+a.scaleX+", "+a.scaleY+", 1)":"translate("+(a.x-a.regX)+"px, "+(a.y-a.regY)+"px)rotate("+a.rotation+"deg)scale("+a.scaleX+", "+a.scaleY+")";return b}var a=document.createElement("div"),c=a.style[Quark.cssPrefix+"Transform"]!=void 0,d=a.style[Quark.cssPrefix+"Perspective"]!=void 0,e=document.documentElement;if(d&&"webkitPerspective"in e.style){a.id="test3d";
  var f=document.createElement("style");f.textContent="@media (-webkit-transform-3d){#test3d{height:3px}}";document.head.appendChild(f);e.appendChild(a);d=a.offsetHeight===3;f.parentNode.removeChild(f);a.parentNode.removeChild(a)}Quark.supportTransform=c;Quark.supportTransform3D=d;if(c){var h=Quark.DOMContext=function(a){h.superClass.constructor.call(this,a)};Quark.inherit(h,Quark.Context);h.prototype.draw=function(a){if(!a._addedToDOM){var c=a.parent,b=a.getDrawable(this);if(c!=null){var d=c.getDrawable(this);
  b.parentNode!=d&&d.appendChild(b);if(d.parentNode==null&&c instanceof Quark.Stage)this.canvas.appendChild(d),c._addedToDOM=!0;a._addedToDOM=!0}}};h.prototype.transform=function(a){var c=a.getDrawable(this);if(a.transformEnabled||!a._addedToDOM){var d=Quark.cssPrefix,e=d+"TransformOrigin";d+="Transform";c=c.style;if(!c.display||a.propChanged("visible","alpha"))c.display=!a.visible||a.alpha<=0?"none":"";if(!c.opacity||a.propChanged("alpha"))c.opacity=a.alpha;if(!c.backgroundPosition||a.propChanged("rectX",
  "rectY"))c.backgroundPosition=-a.rectX+"px "+-a.rectY+"px";if(!c.width||a.propChanged("width","height"))c.width=a.width+"px",c.height=a.height+"px";if(!c[e]||a.propChanged("regX","regY"))c[e]=a.regX+"px "+a.regY+"px";if(!c[d]||a.propChanged("x","y","regX","regY","scaleX","scaleY","rotation"))e=Quark.supportTransform3D?b(a,!0):b(a,!1),c[d]=e;if(!c.zIndex||a.propChanged("_depth"))c.zIndex=a._depth;if(a.mask!=null)c[Q.cssPrefix+"MaskImage"]=a.mask.getDrawable(this).style.backgroundImage,c[Q.cssPrefix+
  "MaskRepeat"]="no-repeat",c[Q.cssPrefix+"MaskPosition"]=a.mask.x+"px "+a.mask.y+"px";c.pointerEvents=a.eventEnabled?"auto":"none"}};h.prototype.hide=function(a){a.getDrawable(this).style.display="none"};h.prototype.remove=function(a){var c=a.getDrawable(this),b=c.parentNode;b!=null&&b.removeChild(c);a._addedToDOM=!1}}else trace("Warn: DOMContext requires css transfrom support.")})();
  (function(){var b=Quark.UIDUtil={_counter:0};b.createUID=function(a){var c=a.charCodeAt(a.length-1);c>=48&&c<=57&&(a+="_");return a+this._counter++};b.displayObjectToString=function(a){for(var c;a!=null;a=a.parent){var b=a.id!=null?a.id:a.name;c=c==null?b:b+"."+c;if(a==a.parent)break}return c}})();
  (function(){function b(a,c){for(var d=0;d<a.children.length;d++){var g=a.children[d];if(g.children)b(g,c);else if(c!=null){g=g.getBounds();c.globalAlpha=0.2;c.beginPath();var i=g[0];c.moveTo(i.x-0.5,i.y-0.5);for(var j=1;j<g.length;j++){var k=g[j];c.lineTo(k.x-0.5,k.y-0.5)}c.lineTo(i.x-0.5,i.y-0.5);c.stroke();c.closePath();c.globalAlpha=0.5;c.beginPath();c.rect((g.x>>0)-0.5,(g.y>>0)-0.5,g.width>>0,g.height>>0);c.stroke();c.closePath()}else if(g.drawable.domDrawable)g.drawable.domDrawable.style.border=
  "1px solid #f00"}}Quark.getUrlParams=function(){var e;var a={},c=window.location.href,b=c.indexOf("?");if(b>0)for(var c=c.substring(b+1).split("&"),b=0,d;d=c[b];b++)e=c[b]=d.split("="),d=e,a[d[0]]=d.length>1?d[1]:!0;return a};var a=document.getElementsByTagName("head")[0],c=a.getElementsByTagName("meta"),d=c.length>0?c[c.length-1].nextSibling:a.childNodes[0];Quark.addMeta=function(c){var b=document.createElement("meta"),h;for(h in c)b.setAttribute(h,c[h]);a.insertBefore(b,d)};Quark.toggleDebugRect=
  function(a){a.debug=!a.debug;a._render=a.debug?function(c){c.clear!=null&&c.clear(0,0,a.width,a.height);Quark.Stage.superClass._render.call(a,c);c=a.context.context;if(c!=null)c.save(),c.lineWidth=1,c.strokeStyle="#f00",c.globalAlpha=0.5;b(a,c);c!=null&&c.restore()}:function(c){c.clear!=null&&c.clear(0,0,a.width,a.height);Quark.Stage.superClass._render.call(a,c)}};Quark.cacheObject=function(a,c,b){var d=a.width,i=a.height,j=a.mask,k=Quark.createDOM("canvas",{width:d,height:i}),n=new Quark.CanvasContext({canvas:k});
  a.mask=null;a.render(n);a.mask=j;return c?(a=new Image,a.width=d,a.height=i,a.src=k.toDataURL(b||"image/png"),a):k};Quark._helpContext=new Quark.CanvasContext({canvas:Quark.createDOM("canvas")})})();
  (function(){var b=Quark.Timer=function(a){this.interval=a||50;this.paused=!1;this.info={lastTime:0,currentTime:0,deltaTime:0,realDeltaTime:0};this._startTime=0;this._intervalID=null;this._listeners=[]};b.prototype.start=function(){if(this._intervalID==null){this._startTime=this.info.lastTime=this.info.currentTime=Date.now();var a=this,c=function(){a._intervalID=setTimeout(c,a.interval);a._run()};c()}};b.prototype.stop=function(){clearTimeout(this._intervalID);this._intervalID=null;this._startTime=
  0};b.prototype.pause=function(){this.paused=!0};b.prototype.resume=function(){this.paused=!1};b.prototype._run=function(){if(!this.paused){var a=this.info,c=a.currentTime=Date.now();a.deltaTime=a.realDeltaTime=c-a.lastTime;for(var b=0,e=this._listeners.length,f,h;b<e;b++)f=this._listeners[b],h=f.__runTime||0,h==0?f.step(this.info):c>h&&(f.step(this.info),this._listeners.splice(b,1),b--,e--);a.lastTime=c}};b.prototype.delay=function(a,c){this.addListener({step:a,__runTime:Date.now()+c})};b.prototype.addListener=
  function(a){if(a==null||typeof a.step!="function")throw"Timer Error: The listener object must implement a step() method!";this._listeners.push(a)};b.prototype.removeListener=function(a){a=this._listeners.indexOf(a);a>-1&&this._listeners.splice(a,1)}})();
  (function(){var b=Quark.ImageLoader=function(a){b.superClass.constructor.call(this);this.loading=!1;this._index=-1;this._loaded=0;this._images={};this._totalSize=0;this._loadHandler=Quark.delegate(this._loadHandler,this);this._addSource(a)};Quark.inherit(b,Quark.EventDispatcher);b.prototype.load=function(a){this._addSource(a);this.loading||this._loadNext()};b.prototype._addSource=function(a){if(a){for(var a=a instanceof Array?a:[a],c=0;c<a.length;c++)this._totalSize+=a[c].size||0;this._source=this._source?
  this._source.concat(a):a}};b.prototype._loadNext=function(){this._index++;if(this._index>=this._source.length)this.dispatchEvent({type:"complete",target:this,images:this._images}),this._source=[],this.loading=!1,this._index=-1;else{var a=new Image;a.onload=this._loadHandler;a.src=this._source[this._index].src;this.loading=!0}};b.prototype._loadHandler=function(a){this._loaded++;var c=this._source[this._index];c.image=a.target;this._images[c.id||c.src]=c;this.dispatchEvent({type:"loaded",target:this,
  image:c});this._loadNext()};b.prototype.getLoaded=function(){return this._loaded};b.prototype.getTotal=function(){return this._source.length};b.prototype.getLoadedSize=function(){var a=0,c;for(c in this._images)a+=this._images[c].size||0;return a};b.prototype.getTotalSize=function(){return this._totalSize}})();
  (function(){var b=Quark.Tween=function(c,b,e){this.target=c;this.delay=this.time=0;this.reverse=this.loop=this.paused=!1;this.interval=0;this.ease=a.Linear.EaseNone;this.onComplete=this.onUpdate=this.onStart=this.next=null;this._oldProps={};this._newProps={};this._deltaProps={};this._pausedStartTime=this._pausedTime=this._lastTime=this._startTime=0;this._reverseFlag=1;this._frameCount=this._frameTotal=0;for(var f in b){var h=c[f],g=b[f];h!==void 0&&typeof h=="number"&&typeof g=="number"&&(this._oldProps[f]=
  h,this._newProps[f]=g,this._deltaProps[f]=g-h)}for(f in e)this[f]=e[f]};b.prototype.setProps=function(a,b){for(var e in a)this.target[e]=this._oldProps[e]=a[e];for(e in b)this._newProps[e]=b[e],this._deltaProps[e]=b[e]-this.target[e]};b.prototype._init=function(){this._startTime=Date.now()+this.delay;this._pausedTime=0;if(this.interval>0)this._frameTotal=Math.round(this.time/this.interval);b.add(this)};b.prototype.start=function(){this._init();this.paused=!1};b.prototype.stop=function(){b.remove(this)};
  b.prototype.pause=function(){this.paused=!0;this._pausedStartTime=Date.now()};b.prototype.resume=function(){this.paused=!1;this._pausedTime+=Date.now()-this._pausedStartTime};b.prototype._update=function(){if(!this.paused){var a=Date.now(),d=a-this._startTime-this._pausedTime;if(!(d<0)){if(this._lastTime==0&&this.onStart!=null)this.onStart(this);this._lastTime=a;a=this._frameTotal>0?++this._frameCount/this._frameTotal:d/this.time;a>1&&(a=1);var d=this.ease(a),e;for(e in this._oldProps)this.target[e]=
  this._oldProps[e]+this._deltaProps[e]*this._reverseFlag*d;if(this.onUpdate!=null)this.onUpdate(this,d);if(a>=1){if(this.reverse){if(e=this._oldProps,this._oldProps=this._newProps,this._newProps=e,this._startTime=Date.now(),this._frameCount=0,this._reverseFlag*=-1,!this.loop)this.reverse=!1}else if(this.loop){for(e in this._oldProps)this.target[e]=this._oldProps[e];this._startTime=Date.now();this._frameCount=0}else if(b.remove(this),e=this.next,e!=null&&(e instanceof b?(a=e,e=null):a=e.shift(),a!=
  null))a.next=e,a.start();if(this.onComplete!=null)this.onComplete(this)}}}};b._tweens=[];b.step=function(){for(var a=this._tweens,b=a.length;--b>=0;)a[b]._update()};b.add=function(a){this._tweens.indexOf(a)==-1&&this._tweens.push(a);return this};b.remove=function(a){var b=this._tweens,a=b.indexOf(a);a>-1&&b.splice(a,1);return this};b.to=function(a,d,e){a=new b(a,d,e);a._init();return a};b.from=function(a,d,e){d=new b(a,d,e);e=d._oldProps;d._oldProps=d._newProps;d._newProps=e;d._reverseFlag=-1;for(var f in d._oldProps)a[f]=
  d._oldProps[f];d._init();return d};var a=Quark.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};a.Linear.EaseNone=function(a){return a};a.Quadratic.EaseIn=function(a){return a*a};a.Quadratic.EaseOut=function(a){return-a*(a-2)};a.Quadratic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)};a.Cubic.EaseIn=function(a){return a*a*a};a.Cubic.EaseOut=function(a){return--a*a*a+1};a.Cubic.EaseInOut=function(a){return(a*=
  2)<1?0.5*a*a*a:0.5*((a-=2)*a*a+2)};a.Quartic.EaseIn=function(a){return a*a*a*a};a.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};a.Quartic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a*a*a:-0.5*((a-=2)*a*a*a-2)};a.Quintic.EaseIn=function(a){return a*a*a*a*a};a.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};a.Quintic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)};a.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1};a.Sinusoidal.EaseOut=function(a){return Math.sin(a*
  Math.PI/2)};a.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};a.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};a.Exponential.EaseOut=function(a){return a==1?1:-Math.pow(2,-10*a)+1};a.Exponential.EaseInOut=function(a){return a==0?0:a==1?1:(a*=2)<1?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)};a.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};a.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};a.Circular.EaseInOut=function(a){return(a/=
  0.5)<1?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)};a.Elastic.EaseIn=function(a){var b,e=0.1,f=0.4;if(a==0)return 0;else if(a==1)return 1;else f||(f=0.3);!e||e<1?(e=1,b=f/4):b=f/(2*Math.PI)*Math.asin(1/e);return-(e*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/f))};a.Elastic.EaseOut=function(a){var b,e=0.1,f=0.4;if(a==0)return 0;else if(a==1)return 1;else f||(f=0.3);!e||e<1?(e=1,b=f/4):b=f/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin((a-b)*2*Math.PI/f)+1};a.Elastic.EaseInOut=
  function(a){var b,e=0.1,f=0.4;if(a==0)return 0;else if(a==1)return 1;else f||(f=0.3);!e||e<1?(e=1,b=f/4):b=f/(2*Math.PI)*Math.asin(1/e);return(a*=2)<1?-0.5*e*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/f):e*Math.pow(2,-10*(a-=1))*Math.sin((a-b)*2*Math.PI/f)*0.5+1};a.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};a.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1};a.Back.EaseInOut=function(a){return(a*=2)<1?0.5*a*a*(3.5949095*a-2.5949095):0.5*((a-=2)*a*(3.5949095*a+2.5949095)+
  2)};a.Bounce.EaseIn=function(c){return 1-a.Bounce.EaseOut(1-c)};a.Bounce.EaseOut=function(a){return(a/=1)<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375};a.Bounce.EaseInOut=function(c){return c<0.5?a.Bounce.EaseIn(c*2)*0.5:a.Bounce.EaseOut(c*2-1)*0.5+0.5}})();
  (function(){var b=Quark.Audio=function(a,c,d,e){b.superClass.constructor.call(this);this.src=a;this.autoPlay=c&&d;this.loop=e;this._playing=this._loaded=!1;this._evtHandler=Quark.delegate(this._evtHandler,this);this._element=document.createElement("audio");this._element.preload=c;this._element.src=a;c&&this.load()};Quark.inherit(b,Quark.EventDispatcher);b.prototype.load=function(){this._element.addEventListener("progress",this._evtHandler,!1);this._element.addEventListener("ended",this._evtHandler,
  !1);this._element.addEventListener("error",this._evtHandler,!1);try{this._element.load()}catch(a){trace(a)}};b.prototype._evtHandler=function(a){if(a.type=="progress"){var c=0,b=0,e=a.target.buffered;if(e&&e.length>0)for(c=e.length-1;c>=0;c--)b=e.end(c)-e.start(c);if(b/a.target.duration>=1)this._element.removeEventListener("progress",this._evtHandler),this._element.removeEventListener("error",this._evtHandler),this._loaded=!0,this.dispatchEvent({type:"loaded",target:this}),this.autoPlay&&this.play()}else a.type==
  "ended"?(this.dispatchEvent({type:"ended",target:this}),this.loop?this.play():this._playing=!1):a.type=="error"&&trace("Quark.Audio Error: "+a.target.src)};b.prototype.play=function(){this._loaded?(this._element.play(),this._playing=!0):(this.autoPlay=!0,this.load())};b.prototype.stop=function(){if(this._playing)this._element.pause(),this._playing=!1};b.prototype.loaded=function(){return this._loaded};b.prototype.playing=function(){return this._playing}})();
  (function(){var b=Quark.Drawable=function(a,c){this.domDrawable=this.rawDrawable=null;this.set(a,c)};b.prototype.get=function(a,c){if(c==null||c.canvas.getContext!=null)return this.rawDrawable;else{if(this.domDrawable==null)this.domDrawable=Quark.createDOMDrawable(a,{image:this.rawDrawable});return this.domDrawable}};b.prototype.set=function(a,c){if(a==null?0:a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement)this.rawDrawable=a;if(c===!0)this.domDrawable=
  a;else if(this.domDrawable)this.domDrawable.style.backgroundImage="url("+this.rawDrawable.src+")"}})();
  (function(){var b=Quark.DisplayObject=function(a){this.id=Quark.UIDUtil.createUID("DisplayObject");this.name=null;this.height=this.width=this.regY=this.regX=this.y=this.x=0;this.scaleY=this.scaleX=this.alpha=1;this.rotation=0;this.transformEnabled=this.eventEnabled=this.visible=!0;this.useHandCursor=!1;this.context=this.parent=this.drawable=this.mask=this.polyArea=null;this._depth=0;this._lastState={};this._stateList=["x","y","regX","regY","width","height","alpha","scaleX","scaleY","rotation","visible",
  "_depth"];Quark.merge(this,a,!0);a.mixin&&Quark.merge(this,a.mixin,!1);b.superClass.constructor.call(this,a)};Quark.inherit(b,Quark.EventDispatcher);b.prototype.setDrawable=function(a){this.drawable==null?this.drawable=new Quark.Drawable(a):this.drawable.rawDrawable!=a&&this.drawable.set(a)};b.prototype.getDrawable=function(a){return this._cache||this.drawable&&this.drawable.get(this,a)};b.prototype._update=function(a){this.update(a)};b.prototype.update=function(){return!0};b.prototype._render=function(a){a=
  this.context||a;!this.visible||this.alpha<=0?(a.hide!=null&&a.hide(this),this.saveState(["visible","alpha"])):(a.startDraw(),a.transform(this),this.render(a),a.endDraw(),this.saveState())};b.prototype.render=function(a){a.draw(this,0,0,this.width,this.height,0,0,this.width,this.height)};b.prototype.saveState=function(a){for(var a=a||this._stateList,c=this._lastState,b=0,e=a.length;b<e;b++){var f=a[b];c["last"+f]=this[f]}};b.prototype.getState=function(a){return this._lastState["last"+a]};b.prototype.propChanged=
  function(a){for(var c=arguments.length>0?arguments:this._stateList,b=0,e=c.length;b<e;b++){var f=c[b];if(this._lastState["last"+f]!=this[f])return!0}return!1};b.prototype.hitTestPoint=function(a,c,b){return Quark.hitTestPoint(this,a,c,b)};b.prototype.hitTestObject=function(a,c){return Quark.hitTestObject(this,a,c)};b.prototype.localToGlobal=function(a,c){var b=this.getConcatenatedMatrix();return{x:b.tx+a,y:b.ty+c}};b.prototype.globalToLocal=function(a,c){var b=this.getConcatenatedMatrix().invert();
  return{x:b.tx+a,y:b.ty+c}};b.prototype.localToTarget=function(a,c,b){a=this.localToGlobal(a,c);return b.globalToLocal(a.x,a.y)};b.prototype.getConcatenatedMatrix=function(a){var c=new Quark.Matrix(1,0,0,1,0,0);if(a==this)return c;for(var b=this;b.parent!=null&&b.parent!=a;b=b.parent){var e=1,f=0;b.rotation%360!=0&&(f=b.rotation*Quark.DEG_TO_RAD,e=Math.cos(f),f=Math.sin(f));b.regX!=0&&(c.tx-=b.regX);b.regY!=0&&(c.ty-=b.regY);c.concat(new Quark.Matrix(e*b.scaleX,f*b.scaleX,-f*b.scaleY,e*b.scaleY,b.x,
  b.y))}return c};b.prototype.getBounds=function(){var a=this.width,c=this.height,b=this.getConcatenatedMatrix(),a=this.polyArea||[{x:0,y:0},{x:a,y:0},{x:a,y:c},{x:0,y:c}],c=[],e=a.length,f,h,g,i,j;f=b.transformPoint(a[0],!0,!0);h=g=f.x;i=j=f.y;c[0]=f;for(var k=1;k<e;k++){f=b.transformPoint(a[k],!0,!0);if(h>f.x)h=f.x;else if(g<f.x)g=f.x;if(i>f.y)i=f.y;else if(j<f.y)j=f.y;c[k]=f}c.x=h;c.y=i;c.width=g-h;c.height=j-i;return c};b.prototype.getCurrentWidth=function(){return Math.abs(this.width*this.scaleX)};
  b.prototype.getCurrentHeight=function(){return Math.abs(this.height*this.scaleY)};b.prototype.getStage=function(){for(var a=this;a.parent;)a=a.parent;return a instanceof Quark.Stage?a:null};Quark.DisplayObject.prototype.cache=function(a,c){return this._cache=Quark.cacheObject(this,a,c)};Quark.DisplayObject.prototype.uncache=function(){this._cache=null};Quark.DisplayObject.prototype.toImage=function(a){return Quark.cacheObject(this,!0,a)};b.prototype.toString=function(){return Quark.UIDUtil.displayObjectToString(this)}})();
  (function(){var b=Quark.DisplayObjectContainer=function(a){this.eventChildren=!0;this.autoSize=!1;this.children=[];a=a||{};b.superClass.constructor.call(this,a);this.id=a.id||Quark.UIDUtil.createUID("DisplayObjectContainer");this.setDrawable(a.drawable||a.image||null);if(a.children)for(var c=0;c<a.children.length;c++)this.addChild(a.children[c])};Quark.inherit(b,Quark.DisplayObject);b.prototype.addChildAt=function(a,c){if(c<0)c=0;else if(c>this.children.length)c=this.children.length;var b=this.getChildIndex(a);
  if(b!=-1){if(b==c)return this;this.children.splice(b,1)}else a.parent&&a.parent.removeChild(a);this.children.splice(c,0,a);a.parent=this;if(this.autoSize){var b=new Quark.Rectangle(0,0,this.rectWidth||this.width,this.rectHeight||this.height),e=new Quark.Rectangle(a.x,a.y,a.rectWidth||a.width,a.rectHeight||a.height);b.union(e);this.width=b.width;this.height=b.height}return this};b.prototype.addChild=function(a){for(var c=this.children.length,b=0;b<arguments.length;b++)a=arguments[b],this.addChildAt(a,
  c+b);return this};b.prototype.removeChildAt=function(a){if(a<0||a>=this.children.length)return!1;var c=this.children[a];if(c!=null){var b=this.getStage();b!=null&&b.context.remove(c);c.parent=null}this.children.splice(a,1);return!0};b.prototype.removeChild=function(a){return this.removeChildAt(this.children.indexOf(a))};b.prototype.removeAllChildren=function(){for(;this.children.length>0;)this.removeChildAt(0)};b.prototype.getChildAt=function(a){return a<0||a>=this.children.length?null:this.children[a]};
  b.prototype.getChildIndex=function(a){return this.children.indexOf(a)};b.prototype.setChildIndex=function(a,c){if(a.parent==this){var b=this.children.indexOf(a);c!=b&&(this.children.splice(b,1),this.children.splice(c,0,a))}};b.prototype.swapChildren=function(a,c){var b=this.getChildIndex(a),e=this.getChildIndex(c);this.children[b]=c;this.children[e]=a};b.prototype.swapChildrenAt=function(a,c){var b=this.getChildAt(a),e=this.getChildAt(c);this.children[a]=e;this.children[c]=b};b.prototype.getChildById=
  function(a){for(var c=0,b=this.children.length;c<b;c++){var e=this.children[c];if(e.id==a)return e}return null};b.prototype.removeChildById=function(a){for(var c=0,b=this.children.length;c<b;c++)if(this.children[c].id==a)return this.removeChildAt(c);return null};b.prototype.sortChildren=function(a){if(typeof a=="string")var c=a,a=function(a,b){return b[c]-a[c]};this.children.sort(a)};b.prototype.contains=function(a){return this.getChildIndex(a)!=-1};b.prototype.getNumChildren=function(){return this.children.length};
  b.prototype._update=function(a){var c=!0;this.update!=null&&(c=this.update(a));if(c!==!1)for(var c=this.children.slice(0),b=0,e=c.length;b<e;b++){var f=c[b];f._depth=b+1;f._update(a)}};b.prototype.render=function(a){b.superClass.render.call(this,a);for(var c=0,d=this.children.length;c<d;c++)this.children[c]._render(a)};b.prototype.getObjectUnderPoint=function(a,c,b,e){if(e)var f=[];for(var h=this.children.length-1;h>=0;h--){var g=this.children[h];if(!(g==null||!g.eventEnabled&&g.children==void 0||
  !g.visible||g.alpha<=0))if(g.children!=void 0&&g.eventChildren&&g.getNumChildren()>0){var i=g.getObjectUnderPoint(a,c,b,e);if(i)if(e)i.length>0&&(f=f.concat(i));else return i;else if(g.hitTestPoint(a,c,b)>=0)if(e)f.push(g);else return g}else if(g.hitTestPoint(a,c,b)>=0)if(e)f.push(g);else return g}return e?f:null}})();
  (function(){var b=Quark.Stage=function(a){this.stageY=this.stageX=0;this.paused=!1;this._eventTarget=null;a=a||{};b.superClass.constructor.call(this,a);this.id=a.id||Quark.UIDUtil.createUID("Stage");if(this.context==null)throw"Quark.Stage Error: context is required.";this.updatePosition()};Quark.inherit(b,Quark.DisplayObjectContainer);b.prototype.step=function(a){this.paused||(this._update(a),this._render(this.context))};b.prototype._update=function(a){for(var c=this.children.slice(0),b=0,e=c.length;b<
  e;b++){var f=c[b];f._depth=b+1;f._update(a)}this.update!=null&&this.update(a)};b.prototype._render=function(a){a.clear!=null&&a.clear(0,0,this.width,this.height);b.superClass._render.call(this,a)};b.prototype.dispatchEvent=function(a){var c=a.pageX||a.clientX,d=a.pageY||a.clientY,c=(c-this.stageX)/this.scaleX,d=(d-this.stageY)/this.scaleY,e=this.getObjectUnderPoint(c,d,!0),f=this._eventTarget;a.eventX=c;a.eventY=d;c=a.type=="mouseout"&&!this.context.canvas.contains(a.relatedTarget);if(f!=null&&(f!=
  e||c))a.lastEventTarget=f,(d=c||e==null||a.type=="mousemove"?"mouseout":a.type=="touchmove"?"touchout":null)&&f.dispatchEvent({type:d}),this._eventTarget=null;if(e!=null&&e.eventEnabled&&a.type!="mouseout")a.eventTarget=f=this._eventTarget=e,e.dispatchEvent(a);if(!Quark.supportTouch)this.context.canvas.style.cursor=f&&f.useHandCursor&&f.eventEnabled?"pointer":"";(c||a.type!="mouseout")&&b.superClass.dispatchEvent.call(this,a)};b.prototype.updatePosition=function(){var a=Quark.getElementOffset(this.context.canvas);
  this.stageX=a.left;this.stageY=a.top}})();
  (function(){var b=Quark.Bitmap=function(a){this.image=null;this.rectHeight=this.rectWidth=this.rectY=this.rectX=0;a=a||{};b.superClass.constructor.call(this,a);this.id=a.id||Quark.UIDUtil.createUID("Bitmap");this.setRect(a.rect||[0,0,this.image.width,this.image.height]);this.setDrawable(this.image);this._stateList.push("rectX","rectY","rectWidth","rectHeight")};Quark.inherit(b,Quark.DisplayObject);b.prototype.setRect=function(a){this.rectX=a[0];this.rectY=a[1];this.rectWidth=this.width=a[2];this.rectHeight=
  this.height=a[3]};b.prototype.render=function(a){a.draw(this,this.rectX,this.rectY,this.rectWidth,this.rectHeight,0,0,this.width,this.height)}})();
  (function(){var b=Quark.MovieClip=function(a){this.interval=0;this.useFrames=this.paused=!1;this.currentFrame=0;this._frames=[];this._frameLabels={};this._frameDisObj=null;this._displayedCount=0;a=a||{};b.superClass.constructor.call(this,a);this.id=a.id||Quark.UIDUtil.createUID("MovieClip");a.frames&&this.addFrame(a.frames)};Quark.inherit(b,Quark.Bitmap);b.prototype.addFrame=function(a){var c=this._frames.length;if(a instanceof Array)for(var b=0;b<a.length;b++)this.setFrame(a[b],c+b);else this.setFrame(a,
  c);return this};b.prototype.setFrame=function(a,b){b==void 0||b>this._frames.length?b=this._frames.length:b<0&&(b=0);this._frames[b]=a;a.label&&(this._frameLabels[a.label]=a);if(a.interval==void 0)a.interval=this.interval;b==0&&this.currentFrame==0&&this.setRect(a.rect)};b.prototype.getFrame=function(a){return typeof a=="number"?this._frames[a]:this._frameLabels[a]};b.prototype.play=function(){this.paused=!1};b.prototype.stop=function(){this.paused=!0};b.prototype.gotoAndStop=function(a){this.currentFrame=
  this.getFrameIndex(a);this.paused=!0};b.prototype.gotoAndPlay=function(a){this.currentFrame=this.getFrameIndex(a);this.paused=!1};b.prototype.getFrameIndex=function(a){if(typeof a=="number")return a;for(var a=this._frameLabels[a],b=this._frames,d=0;d<b.length;d++)if(a==b[d])return d;return-1};b.prototype.nextFrame=function(a){var b=this._frames[this.currentFrame];if(b.interval>0)a=this._displayedCount+a,this._displayedCount=b.interval>a?a:0;if(b.jump>=0||typeof b.jump=="string")if(this._displayedCount==
  0||!b.interval)return this.currentFrame=this.getFrameIndex(b.jump);return b.interval>0&&this._displayedCount>0?this.currentFrame:this.currentFrame>=this._frames.length-1?this.currentFrame=0:++this.currentFrame};b.prototype.getNumFrames=function(){return this._frames.length};b.prototype._update=function(a){var c=this._frames[this.currentFrame];c.stop?this.stop():(this.paused||(c=this._frames[this.nextFrame(this.useFrames?1:a&&a.deltaTime)]),this.setRect(c.rect),b.superClass._update.call(this,a))};
  b.prototype.render=function(a){var b=this._frames[this.currentFrame].rect;a.draw(this,b[0],b[1],b[2],b[3],0,0,this.width,this.height)}})();
  (function(){var b=Quark.Button=function(a){this.state=b.UP;this.enabled=!0;a=a||{};b.superClass.constructor.call(this,a);this.id=a.id||Quark.UIDUtil.createUID("Button");this._skin=new Quark.MovieClip({id:"skin",image:a.image});this.addChild(this._skin);this._skin.stop();this.eventChildren=!1;if(a.useHandCursor===void 0)this.useHandCursor=!0;a.up&&this.setUpState(a.up);a.over&&this.setOverState(a.over);a.down&&this.setDownState(a.down);a.disabled&&this.setDisabledState(a.disabled)};Quark.inherit(b,
  Quark.DisplayObjectContainer);b.UP="up";b.OVER="over";b.DOWN="down";b.DISABLED="disabled";b.prototype.setUpState=function(a){a.label=b.UP;this._skin.setFrame(a,0);this.upState=a;return this};b.prototype.setOverState=function(a){a.label=b.OVER;this._skin.setFrame(a,1);this.overState=a;return this};b.prototype.setDownState=function(a){a.label=b.DOWN;this._skin.setFrame(a,2);this.downState=a;return this};b.prototype.setDisabledState=function(a){a.label=b.DISABLED;this._skin.setFrame(a,3);this.disabledState=
  a;return this};b.prototype.setEnabled=function(a){if(this.enabled==a)return this;(this.eventEnabled=this.enabled=a)?this._skin.currentFrame==3&&this._skin.gotoAndStop(b.UP):this.disabledState?this._skin.gotoAndStop(b.DISABLED):this._skin.gotoAndStop(b.UP);return this};b.prototype.changeState=function(a){if(this.state!=a){this.state=a;switch(a){case b.OVER:case b.DOWN:case b.UP:if(!this.enabled)this.eventEnabled=this.enabled=!0;this._skin.gotoAndStop(a);break;case b.DISABLED:this.setEnabled(!1)}return this}};
  b.prototype.dispatchEvent=function(a){if(this.enabled){switch(a.type){case "mousemove":this.overState&&this.changeState(b.OVER);break;case "mousedown":case "touchstart":case "touchmove":this.downState&&this.changeState(b.DOWN);break;case "mouseup":this.overState?this.changeState(b.OVER):this.changeState(b.UP);break;case "mouseout":case "touchout":case "touchend":this.upState&&this.changeState(b.UP)}b.superClass.dispatchEvent.call(this,a)}};b.prototype.setDrawable=function(){b.superClass.setDrawable.call(this,
  null)}})();
  (function(){var b=Quark.Graphics=function(a){this.lineWidth=1;this.strokeStyle="0";this.lineAlpha=1;this.lineJoin=this.lineCap=null;this.miterLimit=10;this.hasFill=this.hasStroke=!1;this.fillStyle="0";this.fillAlpha=1;a=a||{};b.superClass.constructor.call(this,a);this.id=Quark.UIDUtil.createUID("Graphics");this._actions=[];this._cache=null};Quark.inherit(b,Quark.DisplayObject);b.prototype.lineStyle=function(a,b,d,e,f,h){this._addAction(["lineWidth",this.lineWidth=a||1]);this._addAction(["strokeStyle",this.strokeStyle=
  b||"0"]);this._addAction(["lineAlpha",this.lineAlpha=d||1]);if(e!=void 0)this._addAction(["lineCap",this.lineCap=e]);if(f!=void 0)this._addAction(["lineJoin",this.lineJoin=f]);if(h!=void 0)this._addAction(["miterLimit",this.miterLimit=h]);this.hasStroke=!0;return this};b.prototype.beginFill=function(a,b){this._addAction(["fillStyle",this.fillStyle=a]);this._addAction(["fillAlpha",this.fillAlpha=b||1]);this.hasFill=!0;return this};b.prototype.endFill=function(){this.hasStroke&&this._addAction(["stroke"]);
  this.hasFill&&this._addAction(["fill"]);return this};b.prototype.beginLinearGradientFill=function(a,c,d,e,f,h){a=b._getContext().createLinearGradient(a,c,d,e);c=0;for(d=f.length;c<d;c++)a.addColorStop(h[c],f[c]);return this._addAction(["fillStyle",this.fillStyle=a])};b.prototype.beginRadialGradientFill=function(a,c,d,e,f,h,g,i){a=b._getContext().createRadialGradient(a,c,d,e,f,h);c=0;for(d=g.length;c<d;c++)a.addColorStop(i[c],g[c]);return this._addAction(["fillStyle",this.fillStyle=a])};b.prototype.beginBitmapFill=
  function(a,c){return this._addAction(["fillStyle",this.fillStyle=b._getContext().createPattern(a,c||"")])};b.prototype.beginPath=function(){return this._addAction(["beginPath"])};b.prototype.closePath=function(){return this._addAction(["closePath"])};b.prototype.drawRect=function(a,b,d,e){return this._addAction(["rect",a,b,d,e])};b.prototype.drawRoundRectComplex=function(a,b,d,e,f,h,g,i){this._addAction(["moveTo",a+f,b]);this._addAction(["lineTo",a+d-h,b]);this._addAction(["arc",a+d-h,b+h,h,-Math.PI/
  2,0,!1]);this._addAction(["lineTo",a+d,b+e-g]);this._addAction(["arc",a+d-g,b+e-g,g,0,Math.PI/2,!1]);this._addAction(["lineTo",a+i,b+e]);this._addAction(["arc",a+i,b+e-i,i,Math.PI/2,Math.PI,!1]);this._addAction(["lineTo",a,b+f]);this._addAction(["arc",a+f,b+f,f,Math.PI,Math.PI*3/2,!1]);return this};b.prototype.drawRoundRect=function(a,b,d,e,f){return this.drawRoundRectComplex(a,b,d,e,f,f,f,f)};b.prototype.drawCircle=function(a,b,d){return this._addAction(["arc",a+d,b+d,d,0,Math.PI*2,0])};b.prototype.drawEllipse=
  function(a,b,d,e){if(d==e)return this.drawCircle(a,b,d);d/=2;e/=2;var f=0.5522847498307933*d,h=0.5522847498307933*e;a+=d;b+=e;this._addAction(["moveTo",a+d,b]);this._addAction(["bezierCurveTo",a+d,b-h,a+f,b-e,a,b-e]);this._addAction(["bezierCurveTo",a-f,b-e,a-d,b-h,a-d,b]);this._addAction(["bezierCurveTo",a-d,b+h,a-f,b+e,a,b+e]);this._addAction(["bezierCurveTo",a+f,b+e,a+d,b+h,a+d,b]);return this};b.prototype.drawSVGPath=function(a){a=a.split(/,| (?=[a-zA-Z])/);this._addAction(["beginPath"]);for(var b=
  0,d=a.length;b<d;b++){var e=a[b],f=e[0].toUpperCase(),e=e.substring(1).split(/,| /);e[0].length==0&&e.shift();switch(f){case "M":this._addAction(["moveTo",e[0],e[1]]);break;case "L":this._addAction(["lineTo",e[0],e[1]]);break;case "C":this._addAction(["bezierCurveTo",e[0],e[1],e[2],e[3],e[4],e[5]]);break;case "Z":this._addAction(["closePath"])}}return this};b.prototype._draw=function(a){a.beginPath();for(var b=0,d=this._actions.length;b<d;b++){var e=this._actions[b],f=e[0],h=e.length>1?e.slice(1):
  null;typeof a[f]=="function"?a[f].apply(a,h):a[f]=e[1]}};b.prototype.getDrawable=function(a){this.drawable==null&&this.setDrawable(this.toImage());return this.drawable.get(this,a)};b.prototype.cache=function(a){var b=Quark.createDOM("canvas",{width:this.width,height:this.height});this._draw(b.getContext("2d"));this._cache=b;if(a)this._cache=this.toImage();return this._cache};b.prototype.uncache=function(){this._cache=null};b.prototype.toImage=function(a){var b=this._cache||this.cache(!0);if(b instanceof
  HTMLImageElement)return b;var d=new Image;d.src=b.toDataURL(a||"image/png");d.width=this.width;d.height=this.height;return d};b.prototype.clear=function(){this._actions.length=0;this._cache=null;this.lineWidth=1;this.strokeStyle="0";this.lineAlpha=1;this.lineJoin=this.lineCap=null;this.miterLimit=10;this.hasStroke=!1;this.fillStyle="0";this.fillAlpha=1};b.prototype._addAction=function(a){this._actions.push(a);return this};b._getContext=function(){var a=Quark.createDOM("canvas").getContext("2d");this._getContext=
  function(){return a};return a}})();
  (function(){var b=Quark.Text=function(a){this.text="";this.font="12px arial";this.color="#000";this.textAlign="start";this.outline=!1;this.maxWidth=1E4;this.lineWidth=null;this.lineSpacing=0;this.fontMetrics=null;a=a||{};b.superClass.constructor.call(this,a);this.id=Quark.UIDUtil.createUID("Text");if(this.fontMetrics==null)this.fontMetrics=b.getFontMetrics(this.font)};Quark.inherit(b,Quark.DisplayObject);b.prototype._draw=function(a){if(this.text&&this.text.length!=0){a.font=this.font;a.textAlign=
  this.textAlign;a.textBaseline="top";this.outline?a.strokeStyle=this.color:a.fillStyle=this.color;var b=this.text.split(/\r\n|\r|\n|<br(?:[ \/])*>/),d=0,e=this.fontMetrics.height+this.lineSpacing;this.width=this.lineWidth||0;for(var f=0,h=b.length;f<h;f++){var g=b[f],i=a.measureText(g).width;if(this.lineWidth==null||i<this.lineWidth){if(i>this.width)this.width=i;this._drawTextLine(a,g,d)}else{for(var g=g.split(/([^\x00-\xff]|\b)/),i=g[0],j=1,k=g.length;j<k;j++){var n=g[j];n&&n.length!=0&&(a.measureText(i+
  n).width>this.lineWidth?(this._drawTextLine(a,i,d),d+=e,i=n):i+=n)}this._drawTextLine(a,i,d)}d+=e}this.height=d}};b.prototype._drawTextLine=function(a,b,d){var e=0;switch(this.textAlign){case "center":e=this.width*0.5;break;case "right":case "end":e=this.width}this.outline?a.strokeText(b,e,d,this.maxWidth):a.fillText(b,e,d,this.maxWidth)};b.prototype.setFont=function(a,c){if(this.font!=a&&(this.font=a,!c))this.fontMetrics=b.getFontMetrics(this.font)};b.prototype.render=function(a){if(a instanceof
  Quark.DOMContext){var c=this.getDrawable(a),d=c.style;d.font=this.font;d.textAlign=this.textAlign;d.color=this.color;d.width=this.width+"px";d.height=this.height+"px";d.lineHeight=this.fontMetrics.height+this.lineSpacing+"px";c.innerHTML=this.text}b.superClass.render.call(this,a)};b.prototype.getDrawable=function(a){this.drawable==null&&this.setDrawable(Quark.createDOM("div"),!0);return this.drawable.get(this,a)};b.getFontMetrics=function(a){var b={},a=Quark.createDOM("div",{style:{font:a,position:"absolute"},
  innerHTML:"M"});document.body.appendChild(a);b.height=a.offsetHeight;a.innerHTML='<div style="display:inline-block; width:1px; height:1px;"></div>';var d=a.childNodes[0];b.ascent=d.offsetTop+d.offsetHeight;b.descent=b.height-b.ascent;document.body.removeChild(a);return b}})();/*  |xGv00|c67bbb2b47b4093ce624663d551a5e81 */