(function(c){var b=c.Quark=c.Quark||{version:"1.0.0",global:c},a=function(){};b.inherit=function(b,g){a.prototype=g.prototype;b.superClass=g.prototype;b.prototype=new a;b.prototype.constructor=b};b.merge=function(a,b,c){for(var e in b)if(!c||a.hasOwnProperty(e))a[e]=b[e];return a};b.delegate=function(a,b){var d=b||c;if(arguments.length>2){var e=Array.prototype.slice.call(arguments,2);return function(){var b=Array.prototype.concat.apply(e,arguments);return a.apply(d,b)}}else return function(){return a.apply(d, arguments)}};b.getDOM=function(a){return document.getElementById(a)};b.createDOM=function(a,b){var c=document.createElement(a),e;for(e in b){var h=b[e];if(e=="style")for(var i in h)c.style[i]=h[i];else c[e]=h}return c};b.use=function(a){for(var a=a.split("."),b=c,d=0;d0};c.prototype.on=c.prototype.addEventListener;c.prototype.un=c.prototype.removeEventListener;c.prototype.fire=c.prototype.dispatchEvent})();(function(){var c=Quark.UIDUtil={_counter:0};c.createUID=function(b){var a=b.charCodeAt(b.length-1);a>=48&&a<=57&&(b+="_");return b+this._counter++};c.displayObjectToString=function(b){for(var a;b!=null;b=b.parent){var f=b.id!=null?b.id:b.name;a=a==null?f:f+"."+a;if(b==b.parent)break}return a}})();(function(){function c(a,b){for(var f=0;f>0)-0.5,(i.y>>0)-0.5,i.width>>0,i.height>>0);b.stroke();b.closePath()}else if(h.drawable.domDrawable)h.drawable.domDrawable.style.border= "1px solid #f00"}}Quark.getUrlParams=function(){var d;var a={},b=window.location.href,f=b.indexOf("?");if(f>0)for(var b=b.substring(f+1).split("&"),f=0,c;c=b[f];f++)d=b[f]=c.split("="),c=d,a[c[0]]=c.length>1?c[1]:!0;return a};var b=document.head,a=b.getElementsByTagName("meta"),f=a.length>0?a[a.length-1].nextSibling:b.childNodes[0];Quark.addMeta=function(a){var c=document.createElement("meta"),e;for(e in a)c.setAttribute(e,a[e]);b.insertBefore(c,f)};Quark.toggleDebugRect=function(a){a.paused=!a.paused; if(a.paused){var b=a.context;a._update(b);b=b.context;if(b!=null)b.save(),b.lineWidth=1,b.strokeStyle="#f00",b.globalAlpha=0.5;c(a,b);b!=null&&b.restore()}}})();(function(){var c=Quark.Timer=function(b){this.interval=b||50;this.paused=!1;this.info={lastTime:0,currentTime:0,deltaTime:0,realDeltaTime:0};this._startTime=0;this._intervalID=null;this._listeners=[]};c.prototype.start=function(){if(this._intervalID==null){this._startTime=this.info.lastTime=this.info.currentTime=Date.now();var b=this,a=function(){b._intervalID=setTimeout(a,b.interval);b._run()};a()}};c.prototype.stop=function(){clearTimeout(this._intervalID);this._intervalID=null;this._startTime= 0};c.prototype.pause=function(){this.paused=!0};c.prototype.resume=function(){this.paused=!1};c.prototype._run=function(){if(!this.paused){var b=this.info,a=b.currentTime=Date.now();b.deltaTime=b.realDeltaTime=a-b.lastTime;for(var f=0,c=this._listeners.length,d,e;fe&&(d.step(this.info),this._listeners.splice(f,1),f--,c--);b.lastTime=a}};c.prototype.delay=function(b,a){this.addListener({step:b,__runTime:Date.now()+a})};c.prototype.addListener= function(b){if(b==null||typeof b.step!="function")throw"Timer Error: The listener object must implement a step() method!";this._listeners.push(b)};c.prototype.removeListener=function(b){b=this._listeners.indexOf(b);b>-1&&this._listeners.splice(b,1)}})();(function(){var c=Quark.ImageLoader=function(b){c.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(b)};Quark.inherit(c,Quark.EventDispatcher);c.prototype.load=function(b){this._addSource(b);this.loading||this._loadNext()};c.prototype._addSource=function(b){if(b){for(var b=b instanceof Array?b:[b],a=0;a=this._source.length)this.dispatchEvent({type:"complete",target:this,images:this._images}),this._source=[],this.loading=!1,this._index=-1;else{var b=new Image;b.onload=this._loadHandler;b.src=this._source[this._index].src;this.loading=!0}};c.prototype._loadHandler=function(b){this._loaded++;var a=this._source[this._index];a.image=b.target;this._images[a.id||a.src]=a;this.dispatchEvent({type:"loaded",target:this, image:a});this._loadNext()};c.prototype.getLoaded=function(){return this._loaded};c.prototype.getTotal=function(){return this._source.length};c.prototype.getLoadedSize=function(){var b=0,a;for(a in this._images)b+=this._images[a].size||0;return b};c.prototype.getTotalSize=function(){return this._totalSize}})();(function(){var c=Quark.Tween=function(a,f,c){this.target=a;this.delay=this.time=0;this.reverse=this.loop=this.paused=!1;this.interval=0;this.ease=b.Linear.EaseNone;this.onComplete=this.onUpdate=this.onStart=this.next=null;this._oldProps={};this._newProps={};this._deltaProps={};this._lastTime=this._startTime=0;this._reverseFlag=1;this._frameCount=this._frameTotal=0;for(var d in f){var e=a[d],h=f[d];e!==void 0&&typeof e=="number"&&typeof h=="number"&&(this._oldProps[d]=e,this._newProps[d]=h,this._deltaProps[d]= h-e)}for(d in c)this[d]!==void 0&&(this[d]=c[d])};c.prototype.setProps=function(a,b){for(var c in a)this.target[c]=this._oldProps[c]=a[c];for(c in b)this._newProps[c]=b[c],this._deltaProps[c]=b[c]-this.target[c]};c.prototype._init=function(){this._startTime=Date.now()+this.delay;if(this.interval>0)this._frameTotal=Math.round(this.time/this.interval);c.add(this)};c.prototype.start=function(){this._init();this.paused=!1};c.prototype.stop=function(){this.paused=!0;c.remove(this)};c.prototype.pause=function(){this.paused= !0};c.prototype._update=function(){if(!this.paused){var a=Date.now(),b=a-this._startTime;if(!(b<0)){if(this._lastTime==0&&this.onStart!=null)this.onStart(this);this._lastTime=a;a=this._frameTotal>0?++this._frameCount/this._frameTotal:b/this.time;a>1&&(a=1);var b=this.ease(a),g;for(g in this._oldProps)this.target[g]=this._oldProps[g]+this._deltaProps[g]*this._reverseFlag*b;if(this.onUpdate!=null)this.onUpdate(this,b);if(a>=1){if(this.reverse){if(g=this._oldProps,this._oldProps=this._newProps,this._newProps= g,this._startTime=Date.now(),this._frameCount=0,this._reverseFlag*=-1,!this.loop)this.reverse=!1}else if(this.loop){for(g in this._oldProps)this.target[g]=this._oldProps[g];this._startTime=Date.now();this._frameCount=0}else if(c.remove(this),g=this.next,g!=null&&(g instanceof c?(a=g,g=null):a=g.shift(),a!=null))a.next=g,a.start();if(this.onComplete!=null)this.onComplete(this)}}}};c._tweens=[];c.step=function(){for(var a=this._tweens,b=a.length;--b>=0;)a[b]._update()};c.add=function(a){this._tweens.indexOf(a)== -1&&this._tweens.push(a);return this};c.remove=function(a){var b=this._tweens,a=b.indexOf(a);a>-1&&b.splice(a,1);return this};c.to=function(a,b,g){a=new c(a,b,g);a._init();return a};c.from=function(a,b,g){b=new c(a,b,g);g=b._oldProps;b._oldProps=b._newProps;b._newProps=g;b._reverseFlag=-1;for(var d in b._oldProps)a[d]=b._oldProps[d];b._init();return b};var b=Quark.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};b.Linear.EaseNone= function(a){return a};b.Quadratic.EaseIn=function(a){return a*a};b.Quadratic.EaseOut=function(a){return-a*(a-2)};b.Quadratic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)};b.Cubic.EaseIn=function(a){return a*a*a};b.Cubic.EaseOut=function(a){return--a*a*a+1};b.Cubic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a*a:0.5*((a-=2)*a*a+2)};b.Quartic.EaseIn=function(a){return a*a*a*a};b.Quartic.EaseOut=function(a){return-(--a*a*a*a-1)};b.Quartic.EaseInOut=function(a){return(a*=2)<1?0.5*a* a*a*a:-0.5*((a-=2)*a*a*a-2)};b.Quintic.EaseIn=function(a){return a*a*a*a*a};b.Quintic.EaseOut=function(a){return(a-=1)*a*a*a*a+1};b.Quintic.EaseInOut=function(a){return(a*=2)<1?0.5*a*a*a*a*a:0.5*((a-=2)*a*a*a*a+2)};b.Sinusoidal.EaseIn=function(a){return-Math.cos(a*Math.PI/2)+1};b.Sinusoidal.EaseOut=function(a){return Math.sin(a*Math.PI/2)};b.Sinusoidal.EaseInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};b.Exponential.EaseIn=function(a){return a==0?0:Math.pow(2,10*(a-1))};b.Exponential.EaseOut= function(a){return a==1?1:-Math.pow(2,-10*a)+1};b.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)};b.Circular.EaseIn=function(a){return-(Math.sqrt(1-a*a)-1)};b.Circular.EaseOut=function(a){return Math.sqrt(1- --a*a)};b.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)};b.Elastic.EaseIn=function(a){var b,c=0.1,d=0.4;if(a==0)return 0;else if(a==1)return 1;else d||(d=0.3);!c|| c<1?(c=1,b=d/4):b=d/(2*Math.PI)*Math.asin(1/c);return-(c*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/d))};b.Elastic.EaseOut=function(a){var b,c=0.1,d=0.4;if(a==0)return 0;else if(a==1)return 1;else d||(d=0.3);!c||c<1?(c=1,b=d/4):b=d/(2*Math.PI)*Math.asin(1/c);return c*Math.pow(2,-10*a)*Math.sin((a-b)*2*Math.PI/d)+1};b.Elastic.EaseInOut=function(a){var b,c=0.1,d=0.4;if(a==0)return 0;else if(a==1)return 1;else d||(d=0.3);!c||c<1?(c=1,b=d/4):b=d/(2*Math.PI)*Math.asin(1/c);return(a*=2)<1?-0.5*c*Math.pow(2, 10*(a-=1))*Math.sin((a-b)*2*Math.PI/d):c*Math.pow(2,-10*(a-=1))*Math.sin((a-b)*2*Math.PI/d)*0.5+1};b.Back.EaseIn=function(a){return a*a*(2.70158*a-1.70158)};b.Back.EaseOut=function(a){return(a-=1)*a*(2.70158*a+1.70158)+1};b.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)};b.Bounce.EaseIn=function(a){return 1-b.Bounce.EaseOut(1-a)};b.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};b.Bounce.EaseInOut=function(a){return a<0.5?b.Bounce.EaseIn(a*2)*0.5:b.Bounce.EaseOut(a*2-1)*0.5+0.5}})();(function(){var c=Quark.Audio=function(b,a,f,g){c.superClass.constructor.call(this);this.src=b;this.autoPlay=a&&f;this.loop=g;this._playing=this._loaded=!1;this._evtHandler=Quark.delegate(this._evtHandler,this);this._element=document.createElement("audio");this._element.preload=a;this._element.src=b;a&&this.load()};Quark.inherit(c,Quark.EventDispatcher);c.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(b){trace(b)}};c.prototype._evtHandler=function(b){if(b.type=="progress"){var a=0,c=0,g=b.target.buffered;if(g&&g.length>0)for(a=g.length;a>=0;a--)c=g.end(a)-g.start(a);if(c/b.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 b.type== "ended"?(this.dispatchEvent({type:"ended",target:this}),this.loop?this.play():this._playing=!1):b.type=="error"&&trace("Quark.Audio Error: "+b.target.src)};c.prototype.play=function(){this._loaded?(this._element.play(),this._playing=!0):(this.autoPlay=!0,this.load())};c.prototype.stop=function(){if(this._playing)this._element.pause(),this._playing=!1};c.prototype.loaded=function(){return this._loaded};c.prototype.playing=function(){return this._playing}})();(function(){(Quark.Drawable=function(c,b){if(c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement)this.rawDrawable=c;if(b===!0)this.domDrawable=c}).prototype.get=function(c,b){if(b==null||b.canvas.getContext!=null)return this.rawDrawable;else{if(this.domDrawable==null)this.domDrawable=Quark.createDOMDrawable(c,{image:this.rawDrawable});return this.domDrawable}}})();(function(){function c(a){for(var b=new Quark.Matrix(1,0,0,1,0,0);a.parent!=null;a=a.parent){var c=1,e=0;a.rotation%360!=0&&(e=a.rotation*Quark.RADIAN,c=Math.cos(e),e=Math.sin(e));a.regX!=0&&(b.tx-=a.regX);a.regY!=0&&(b.ty-=a.regY);b.concat(new Quark.Matrix(c*a.scaleX,e*a.scaleX,-e*a.scaleY,c*a.scaleY,a.x,a.y))}return b}function b(a,b,c,e){return{x:(b.x-a.x)*e-(b.y-a.y)*c+a.x+0.5>>0,y:(b.y-a.y)*e+(b.x-a.x)*c+a.y+0.5>>0}}var a=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.context=this.parent=this.drawable=null;this._depth=0;this._lastState={};this._stateList=["x","y","regX","regY","width","height","alpha","scaleX","scaleY","rotation","visible","_depth"];Quark.merge(this,a)};a.prototype.setDrawable=function(a){if(this.drawable==null||this.drawable.rawDrawable!=a)this.drawable=new Quark.Drawable(a)}; a.prototype.getDrawable=function(a){return this.drawable&&this.drawable.get(this,a)};a.prototype._update=function(a){this.update(a)};a.prototype.update=function(){};a.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())};a.prototype.render=function(a){a.draw(this,0,0,this.width,this.height,0,0,this.width,this.height)};a.prototype._onEvent= function(a){if(this.onEvent!=null)this.onEvent(a)};a.prototype.onEvent=null;a.prototype.saveState=function(a){for(var a=a||this._stateList,b=this._lastState,c=0,e=a.length;c0?arguments:this._stateList,b=0,c=a.length;b=c.x&&a<=c.x+c.width&&b>=c.y&&b<=c.y+c.height):!1};a.prototype.hitTestObject=function(a,b){var c=this.getBounds(),e=a.getBounds();return!b?c.x<=e.x+e.width&&e.x<=c.x+c.width&&c.y<=e.y+e.height&&e.y<=c.y+c.height:!1};a.prototype.localToGlobal=function(a,b){var d=c(this);return{x:d.tx+a,y:d.ty+b}};a.prototype.globalToLocal=function(a,b){var d=c(this).invert();return{x:d.tx+a,y:d.ty+b}};a.prototype.localToTarget=function(a,b,c){a=this.localToGlobal(a,b);return c.globalToLocal(a.x, a.y)};a.prototype.getBounds=function(a){var a=a==null?this.localToGlobal(0,0):this.localToTarget(0,0,a),c=this.x,d=this.y,e=this.regX,h=this.regY,i=this.getCurrentWidth(),j=this.getCurrentHeight();if(this.rotation%360!=0){var a=this.rotation*Quark.RADIAN,k=Math.sin(a),l=Math.cos(a),n={x:c,y:d},a=b(n,{x:c-e,y:d-h},k,l),m=b(n,{x:c-e+i,y:d-h},k,l),i=b(n,{x:c-e+i,y:d-h+j},k,l),c=b(n,{x:c-e,y:d-h+j},k,l);this._rotatedPoints=[a,m,i,c];d=Math.min(a.x,m.x,i.x,c.x);e=Math.min(a.y,m.y,i.y,c.y);return{x:d,y:e, width:Math.max(a.x,m.x,i.x,c.x)-d,height:Math.max(a.y,m.y,i.y,c.y)-e}}return{x:a.x,y:a.y,width:i,height:j}};a.prototype.getCurrentWidth=function(){return Math.abs(this.width*this.scaleX)};a.prototype.getCurrentHeight=function(){return Math.abs(this.height*this.scaleY)};a.prototype.getStage=function(){for(var a=this;a.parent;)a=a.parent;return a instanceof Quark.Stage?a:null};a.prototype.toString=function(){return Quark.UIDUtil.displayObjectToString(this)}})();(function(){var c=Quark.DisplayObjectContainer=function(b){this.eventChildren=!0;this.autoSize=!1;this.children=[];b=b||{};c.superClass.constructor.call(this,b);this.id=b.id||Quark.UIDUtil.createUID("DisplayObjectContainer");this.setDrawable(b.drawable||b.image||null);if(b.children)for(var a=0;athis.children.length)a=this.children.length;var c=this.getChildIndex(b); if(c!=-1){if(c==a)return this;this.children.splice(c,1)}else b.parent&&b.parent.removeChild(b);this.children.splice(a,0,b);b.parent=this;if(this.autoSize){var c=new Quark.Rectangle(0,0,this.rectWidth||this.width,this.rectHeight||this.height),g=new Quark.Rectangle(b.x,b.y,b.rectWidth||b.width,b.rectHeight||b.height);c.union(g);this.width=c.width;this.height=c.height}return this};c.prototype.addChild=function(b){for(var a=this.children.length,c=0;c=this.children.length)return!1;var a=this.children[b];if(a!=null)this.getStage().context.remove(a),a.parent=null;this.children.splice(b,1);return!0};c.prototype.removeChild=function(b){return this.removeChildAt(this.children.indexOf(b))};c.prototype.removeAllChildren=function(){for(;this.children.length>0;)this.removeChildAt(0)};c.prototype.getChildAt=function(b){return b<0||b>=this.children.length?null:this.children[b]};c.prototype.getChildIndex= function(b){return this.children.indexOf(b)};c.prototype.setChildIndex=function(b,a){if(b.parent==this){var c=this.children.indexOf(b);a!=c&&(this.children.splice(c,1),this.children.splice(a,0,b))}};c.prototype.contains=function(b){return this.getChildIndex(b)!=-1};c.prototype.getNumChildren=function(){return this.children.length};c.prototype._update=function(b){this.update!=null&&this.update(b);for(var a=0,c=this.children.length;a=0;h--){var i=this.children[h];if(!(i==null||!i.eventEnabled||!i.visible||i.alpha<=0))if(i.children!=void 0&&i.eventChildren&&i.getNumChildren()>0){var j=i.getObjectUnderPoint(b,a,c,g,d);if(j)if(d)j.length>0&&(e=e.concat(j));else return j;else if(i.hitTestPoint(b,a,c,g))if(d)e.push(i); else return i}else if(i.hitTestPoint(b,a,c,g))if(d)e.push(i);else return i}return d?e:null}})();(function(){var c=Quark.Stage=function(b){this.stageY=this.stageX=0;this.paused=!1;b=b||{};c.superClass.constructor.call(this,b);this.id=b.id||Quark.UIDUtil.createUID("Stage");if(this.context==null)throw"Quark.Stage Error: context is required.";this.updatePosition()};Quark.inherit(c,Quark.DisplayObjectContainer);c.prototype.step=function(b){this.paused||(this._update(b),this._render(this.context))};c.prototype._update=function(b){for(var a=0,c=this.children.length;athis._frames.length?a=this._frames.length:a<0&&(a=0);this._frames[a]=b;b.label&&(this._frameLabels[b.label]=b);if(b.interval==void 0)b.interval=this.interval;a==0&&this.currentFrame==0&&this.setRect(b.rect)};c.prototype.getFrame=function(b){return typeof b=="number"?this._frames[b]:this._frameLabels[b]};c.prototype.play=function(){this.paused=!1};c.prototype.stop=function(){this.paused=!0};c.prototype.gotoAndStop=function(b){this.currentFrame=this.getFrameIndex(b);this.paused= !0};c.prototype.gotoAndPlay=function(b){this.currentFrame=this.getFrameIndex(b);this.paused=!1};c.prototype.getFrameIndex=function(b){if(typeof b=="number")return b;for(var b=this._frameLabels[b],a=this._frames,c=0;c0)b=this._displayedCount+b,this._displayedCount=a.interval>b?b:0;if(a.jump>=0||typeof a.jump=="string")if(this._displayedCount==0||!a.interval)return this.currentFrame= this.getFrameIndex(a.jump);return a.interval>0&&this._displayedCount>0?this.currentFrame:this.currentFrame>=this._frames.length-1?this.currentFrame=0:++this.currentFrame};c.prototype._update=function(b){var a=this._frames[this.currentFrame];a.stop?this.stop():(this.paused||this.nextFrame(this.useFrames?1:b&&b.deltaTime),this.setRect(a.rect),c.superClass._update.call(this,b))};c.prototype.render=function(b){var a=this._frames[this.currentFrame].rect;b.draw(this,a[0],a[1],a[2],a[3],0,0,this.width,this.height)}})();(function(){var c=Quark.Context=function(b){if(b.canvas==null)throw"Quark.Context Error: canvas is required.";this.canvas=null;Quark.merge(this,b)};c.prototype.startDraw=function(){};c.prototype.draw=function(){};c.prototype.endDraw=function(){};c.prototype.transform=function(){};c.prototype.remove=function(){}})();(function(){var c=Quark.CanvasContext=function(a){c.superClass.constructor.call(this,a);this.context=this.canvas.getContext("2d")};Quark.inherit(c,Quark.Context);c.prototype.startDraw=function(){this.context.save()};c.prototype.draw=function(a){var b=a.getDrawable(this);b!=null&&(arguments[0]=b,this.context.drawImage.apply(this.context,arguments))};c.prototype.endDraw=function(){this.context.restore()};c.prototype.transform=function(a){var c=this.context;(a.x!=0||a.y!=0)&&c.translate(a.x,a.y);a.rotation% 360!=0&&c.rotate(a.rotation%360*b);(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)};c.prototype.clear=function(a,b,c,d){this.context.clearRect(a,b,c,d)};var b=Math.PI/180})();(function(){function c(a,b){var c="";c+=b?"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 c}var b=document.createElement("div"),a=b.style[Quark.cssPrefix+"Transform"]!=void 0,f=b.style[Quark.cssPrefix+"Perspective"]!=void 0,g=document.documentElement;if(f&&"webkitPerspective"in g.style){b.id="test3d"; var d=document.createElement("style");d.textContent="@media (-webkit-transform-3d){#test3d{height:3px}}";document.head.appendChild(d);g.appendChild(b);f=b.offsetHeight===3;d.parentNode.removeChild(d);b.parentNode.removeChild(b)}Quark.supportTransform=a;Quark.supportTransform3D=f;if(!a)throw"Error: DOMContext requires css transfrom support.";var e=Quark.DOMContext=function(a){e.superClass.constructor.call(this,a)};Quark.inherit(e,Quark.Context);e.prototype.draw=function(a){if(!a._addedToDOM){var b= a.parent,c=a.getDrawable(this);b==null&&c.parentNode==null?this.canvas.appendChild(c):(b=b.getDrawable(this),c.parentNode!=b&&b.appendChild(c));a._addedToDOM=!0}};e.prototype.transform=function(a){var b=a.getDrawable(this);if(a.transformEnabled||!a._addedToDOM){var d=Quark.cssPrefix,e=d+"TransformOrigin";d+="Transform";if(a.propChanged("visible","alpha"))b.style.display=!a.visible||a.alpha<=0?"none":"";if(a.propChanged("alpha"))b.style.opacity=a.alpha;if(a.propChanged("rectX","rectY"))b.style.backgroundPosition= -a.rectX+"px "+-a.rectY+"px";if(a.propChanged("width","height"))b.style.width=a.width+"px",b.style.height=a.height+"px";a.propChanged("regX","regY")&&(b.style[e]=a.regX+"px "+a.regY+"px");a.propChanged("x","y","regX","regY","scaleX","scaleY","rotation")&&(e=Quark.supportTransform3D?c(a,!0):c(a,!1),b.style[d]=e);if(a.propChanged("_depth"))b.style.zIndex=a._depth}};e.prototype.hide=function(a){a.getDrawable(this).style.display="none"};e.prototype.remove=function(a){var b=a.getDrawable(this),c=b.parentNode; c!=null&&c.removeChild(b);a._addedToDOM=!1}})();