/*!
 * jCanvaScript JavaScript Library v 1.2.1
 * http://jcscript.com/
 *
 * Copyright 2011, Alexander Savin
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
(function(){var F=[];var p=Math.PI*2;var D=0;var z=0;var w=false;var a=window.navigator.userAgent.match(/Firefox\/\w+\.\w+/i);if(a!=""&&a!==null){var y=(parseInt(a[0].split(/[ \/\.]/i)[1])<4)}var B=/[A-z]+?/;function I(T,S,U){var Q=F[T].layers[S].objs.length;for(var R=0;R<Q;R++){if("#"+F[T].layers[S].objs[R].optns.id==U){return F[T].layers[S].objs[R]}}Q=F[T].layers[S].grdntsnptrns.length;for(R=0;R<Q;R++){if("#"+F[T].layers[S].grdntsnptrns[R].optns.id==U){return F[T].layers[S].grdntsnptrns[R]}}return false}function L(T,S,U,V){var Q=F[T].layers[S].objs.length;for(var R=0;R<Q;R++){if(("."+F[T].layers[S].objs[R]._name)==V){U.elements[U.elements.length]=F[T].layers[S].objs[R]}}Q=F[T].layers[S].grdntsnptrns.length;for(R=0;R<Q;R++){if(("."+F[T].layers[S].grdntsnptrns[R]._name)==V){U.elements[U.elements.length]=F[T].layers[S].grdntsnptrns[R]}}return U}function n(T,S,U){var Q=F[T].layers[S].objs.length;for(var R=0;R<Q;R++){U.elements[U.elements.length]=F[T].layers[S].objs[R]}Q=F[T].layers[S].grdntsnptrns.length;for(R=0;R<Q;R++){U.elements[U.elements.length]=F[T].layers[S].grdntsnptrns[R]}return U}var x=function(aa,Q){if(aa===undefined){return this}if(typeof aa=="object"){Q=aa;aa=undefined}var S=-1;var X=-1;var R=F.length;var Y=0;var T=0;if(Q===undefined){if(aa.charAt(0)=="#"){for(V=0;V<R;V++){Y=F[V].layers.length;for(U=0;U<Y;U++){var W=I(V,U,aa);if(W){return W}}}}if(aa.charAt(0)=="."){var Z=s();for(var V=0;V<R;V++){Y=F[V].layers.length;for(var U=0;U<Y;U++){Z=L(V,U,Z,aa)}}return Z}}else{if(Q.canvas!==undefined){for(V=0;V<R;V++){if(F[V].optns.id==Q.canvas){S=V;break}}}if(Q.layer!==undefined){if(S!=-1){T=F[S].layers.length;for(V=0;V<T;V++){if(F[S].layers[V].optns.id==Q.layer){X=V;break}}}else{for(V=0;V<R;V++){T=F[V].layers.length;for(U=0;U<T;U++){if(F[V].layers[U].optns.id==Q.layer){S=V;X=U;break}}if(X>-1){break}}}}if(X<0&&S<0){return false}if(X<0){Y=F[S].layers.length;if(aa===undefined){Z=s();for(U=0;U<Y;U++){Z=n(S,U,Z)}return Z}if(aa.charAt(0)=="#"){for(U=0;U<Y;U++){W=I(S,U,aa);if(W){return W}}}if(aa.charAt(0)=="."){Z=s();for(U=0;U<Y;U++){Z=L(S,U,Z,aa)}return Z}}else{if(aa===undefined){Z=s();return n(S,X,Z)}if(aa.charAt(0)=="#"){return I(S,X,aa)}if(aa.charAt(0)=="."){Z=s();return L(S,X,Z,aa)}}}};function e(Q){F[Q.optns.canvas.number].optns.redraw=1}function r(){var U=this.animateQueue.length;var Q=1;for(var R=0;R<U;R++){var V=this.animateQueue[R];for(var aa in V){if(this.hasOwnProperty(aa)&&this[aa]!==undefined){if(V[aa]){var Z=V[aa];var S=Z.step;var T=Z.duration;var W=Z.easing;var Y=Z.to;var X=Z.from;Z.step++;Q=S/T;t(aa,this,V);if(W.type=="in"||(W.type=="inOut"&&Q<0.5)){this[aa]=(Y-X)*d[W.fn](Q,W)+X}if(W.type=="out"||(W.type=="inOut"&&Q>0.5)){this[aa]=(Y-X)*(1-d[W.fn](1-Q,W))+X}if(Z.onstep){Z.onstep.fn.call(this,Z.onstep)}if(S>T){this[aa]=Y;t(aa,this,V);V[aa]=false;V.animateKeyCount--}}else{if(!V.animateKeyCount){if(V.animateFn!==undefined){V.animateFn.apply(this)}this.animateQueue.splice(R,1);R--}}}}}if(U==0){this.optns.animated=false}else{e(this)}return this}function t(S,R,Q){var U=R[S];var T=Q[S]["prev"];switch(S){case"_rotateAngle":R.rotate(U-T,R._rotateX,R._rotateY);break;case"_translateX":R.translate(U-T,0);break;case"_translateY":R.translate(0,U-T);break;case"_scaleX":R.scale(U-T,0);break;case"_scaleY":R.scale(0,U-T);break;default:return}Q[S]["prev"]=U}function H(S,R,Q){S=S||window.event;Q[R].code=S.charCode||S.keyCode;Q[R].val=true;Q.redraw++;return false}function k(T,S,R){T=T||window.event;var Q={pageX:T.pageX||T.clientX,pageY:T.pageY||T.clientY};R[S].x=Q.pageX-R.x;R[S].y=Q.pageY-R.y;R.redraw++;return false}function m(R,Q){if(R===undefined){this["on"+Q]()}else{this["on"+Q]=R}if(Q=="mouseover"||Q=="mouseout"){Q="mousemove"}F[this.optns.canvas.number].optns[Q].val=true;return this}function O(R,Q){if(R===undefined){this[Q]()}else{this[Q]=R}return this}var d={linear:function(Q,R){return Q},exp:function(Q,R){var S=R.n||2;return Math.pow(Q,S)},circ:function(Q,R){return 1-Math.sqrt(1-Q*Q)},sine:function(Q,R){return 1-Math.sin((1-Q)*Math.PI/2)},back:function(R,S){var T=S.n||2;var Q=S.x||1.5;return Math.pow(R,T)*((Q+1)*R-Q)},elastic:function(T,U){var V=U.n||2;var R=U.m||20;var S=U.k||3;var Q=U.x||1.5;return Math.pow(V,10*(T-1))*Math.cos(R*T*Math.PI*Q/S)},bounce:function(S,V){var W=V.n||4;var R=V.b||0.25;var U=[1];for(var T=1;T<W;T++){U[T]=U[T-1]+Math.pow(R,T/2)}var Q=2*U[W-1]-1;for(T=0;T<W;T++){if(Q*S>=(T>0?2*U[T-1]-1:0)&&Q*S<=2*U[T]-1){return Math.pow(Q*(S-(2*U[T]-1-Math.pow(R,T/2))/Q),2)+1-Math.pow(R,T)}}return 1}};function g(R,Q){return[[(R[0][0]*Q[0][0]+R[0][1]*Q[1][0]),(R[0][0]*Q[0][1]+R[0][1]*Q[1][1]),(R[0][0]*Q[0][2]+R[0][1]*Q[1][2]+R[0][2])],[(R[1][0]*Q[0][0]+R[1][1]*Q[1][0]),(R[1][0]*Q[0][1]+R[1][1]*Q[1][1]),(R[1][0]*Q[0][2]+R[1][1]*Q[1][2]+R[1][2])]]}function G(R,S,Q){return{x:(R*Q[1][1]-S*Q[0][1]+Q[0][1]*Q[1][2]-Q[1][1]*Q[0][2])/(Q[0][0]*Q[1][1]-Q[1][0]*Q[0][1]),y:(-R*Q[1][0]+S*Q[0][0]-Q[0][0]*Q[1][2]+Q[1][0]*Q[0][2])/(Q[0][0]*Q[1][1]-Q[1][0]*Q[0][1])}}function q(R){var T={};if(R._img!==undefined){T.x=R._sx;T.y=R._sy;T.width=R._img.width;T.height=R._img.height;return T}if(R._width!==undefined&&R._height!==undefined){T.x=R._x;T.y=R._y;T.width=R._width;T.height=R._height;return T}if(R._radius!==undefined){if(R._startAngle===undefined){T.x=R._x-R._radius;T.y=R._y-R._radius;T.width=T.height=R._radius*2;return T}}if(R.shapesCount!==undefined){var Q;var X;var W=Q=R._x0;var V=X=R._y0;for(var S=1;S<R.shapesCount;S++){if(W<R["_x"+S]){W=R["_x"+S]}if(V<R["_y"+S]){V=R["_y"+S]}if(Q>R["_x"+S]){Q=R["_x"+S]}if(X>R["_y"+S]){X=R["_y"+S]}}T.x=Q;T.y=Q;T.width=W-Q;T.height=V-X;return T}if(R.objs!==undefined){for(S=0;S<R.objs.length;S++){var U=q(R.objs[S]);if(T.x>U.x||!S){T.x=U.x}if(T.y>U.y||!S){T.y=U.y}if(T.width<U.width||!S){T.width=U.width}if(T.height<U.height||!S){T.height=U.height}}return T}return false}function N(R){var Q={};if(R.objs!==undefined||R._img!==undefined){var T=q(R);Q.x=(T.x*2+T.width)/2;Q.y=(T.y*2+T.height)/2;return Q}if(R._width!==undefined&&R._height!==undefined){Q.x=(R._x*2+R._width)/2;Q.y=(R._y*2+R._height)/2;return Q}if(R._radius!==undefined){Q.x=R._x;Q.y=R._y;return Q}if(R.shapesCount!==undefined){Q.x=R._x0;Q.y=R._y0;for(var S=1;S<R.shapesCount;S++){Q.x+=R["_x"+S];Q.y+=R["_y"+S]}Q.x=Q.x/R.shapesCount;Q.y=Q.y/R.shapesCount;return Q}return false}function i(T){var R={color:{val:T,notColor:undefined},colorR:0,colorB:0,colorG:0,alpha:0};if(T.id!==undefined){R.color.notColor={level:T._level,canvas:T.optns.canvas.number,layer:T.optns.layer.number};return R}if(T.charAt(0)=="#"){R.colorR=parseInt(T.substr(1,2),16);R.colorG=parseInt(T.substr(3,2),16);R.colorB=parseInt(T.substr(5,2),16);R.alpha=1}else{var Q=T.split(",");if(Q.length==4){var S=Q[0].split("(");var V=Q[3].split(")");R.colorR=parseInt(S[1]);R.colorG=parseInt(Q[1]);R.colorB=parseInt(Q[2]);R.alpha=parseFloat(V[0])}if(Q.length==3){S=Q[0].split("(");var U=Q[2].split(")");R.colorR=parseInt(S[1]);R.colorG=parseInt(Q[1]);R.colorB=parseInt(U[0]);R.alpha=1}}R.color.notColor=undefined;return R}function o(Q){if(Q.getBoundingClientRect){return j(Q)}else{return P(Q)}}function P(Q){var S=0,R=0;while(Q){S=S+parseInt(Q.offsetTop);R=R+parseInt(Q.offsetLeft);Q=Q.offsetParent}return{top:S,left:R}}function j(T){var W=T.getBoundingClientRect();var X=document.body;var R=document.documentElement;var Q=window.pageYOffset||R.scrollTop||X.scrollTop;var U=window.pageXOffset||R.scrollLeft||X.scrollLeft;var V=R.clientTop||X.clientTop||0;var Y=R.clientLeft||X.clientLeft||0;var Z=W.top+Q-V;var S=W.left+U-Y;return{top:Math.round(Z),left:Math.round(S)}}function K(R,Q){h(R,Q);M(R,Q)}function M(R,Q){if(!R.optns.focused){return}if(Q.keyDown.val!=false){if(typeof R.onkeydown=="function"){R.onkeydown(Q.keyDown)}}if(Q.keyUp.val!=false){if(typeof R.onkeyup=="function"){R.onkeyup(Q.keyUp)}}if(Q.keyPress.val!=false){if(typeof R.onkeypress=="function"){R.onkeypress(Q.keyPress)}}}function u(U,R,X){var Q={};var T=F[U.optns.canvas.number];var S=T.optns.ctx;var W=T.layers[U.optns.layer.number];Q.x=R;Q.y=X;if(y){Q=G(R,X,g(U.matrix(),W.matrix()))}if(S.isPointInPath===undefined||U._img!==undefined||U._imgData!==undefined){var V=q(U);Q=G(R,X,g(U.matrix(),W.matrix()));if(V.x<=Q.x&&V.y<=Q.y&&(V.x+V.width)>=Q.x&&(V.y+V.height)>=Q.y){return Q}}else{if(S.isPointInPath(Q.x,Q.y)){return Q}}return false}function h(T,S){var R=false;var Q=S.mousemove.x||S.mousedown.x||S.mouseup.x||S.click.x;var U=S.mousemove.y||S.mousedown.y||S.mouseup.y||S.click.y;if(Q!=false){R=u(T,Q,U)}if(R){if(S.mousemove.x!=false){S.mousemove.object=T}if(S.mousedown.x!=false){S.mousedown.object=T}if(S.click.x!=false){S.click.object=T}if(S.mouseup.x!=false){S.mouseup.object=T}S.point=R}}function J(Q){return F[Q.optns.canvas.number].layers[Q.optns.layer.number]}function c(X,Q,W){e(Q);var S=Q.optns.canvas;var U=Q.optns.layer;if(X===undefined){return U.id}if(U.id==X){return Q}var V={i:S.number,j:U.number};U.id=X;var T=x.layer(X);var R={i:T.optns.canvas.number,j:T._level};F[V.i].layers[V.j][W].splice(Q._level,1);b(F[V.i].layers[V.j][W]);Q._level=F[R.i].layers[R.j][W].length;F[R.i].layers[R.j][W][Q._level]=Q;U.number=R.j;S.number=R.i;e(Q);return Q}function v(T,S){for(var R in S){switch(typeof S[R]){case"function":if(R.substr(0,2)=="on"){break}if(T[R]===undefined){T[R]=S[R]}break;case"object":if(R=="optns"||R=="animateQueue"){break}if(R=="objs"||R=="grdntsnptrns"){for(var Q=0;Q<S[R].length;Q++){S[R][Q].clone().layer(T.optns.id)}break}T[R]=typeof S[R].pop==="function"?[]:{};v(T[R],S[R]);break;default:if(R=="_level"){break}T[R]=S[R]}}}function f(Q,R,W){e(R);var T=R.optns.canvas;var U=R.optns.layer;if(Q===undefined){return F[T.number].optns.id}if(F[T.number].optns.id==Q){return R}var V={i:T.number,j:U.number};x.canvas(Q);for(var S=0;S<F.length;S++){if(F[S].optns.id==Q){F[V.i].layers[V.j][W].splice(R._level,1);b(F[V.i].layers[V.j][W]);R._level=F[S].layers[0][W].length;F[S].layers[0][W][R._level]=R;U.number=0;T.number=S;T.id=F[S].optns.id;U.id=F[S].layers[0].optns.id}}e(R);return R}function b(R){for(var Q=0;Q<R.length;Q++){R[Q]._level=Q}}function A(V){var Q=V.length;var T;for(var R=0;R<Q;R++){if(V[R]._level!=R){T=V[R];var U=T._level;if(U>=Q){U=Q-1}if(U<0){U=0}if(U>R){for(var S=R;S<U;S++){V[S]=V[S+1];V[S]._level=S}}if(U<R){for(S=R;S>U;S--){V[S]=V[S-1];V[S]._level=S}}V[U]=T;V[U]._level=U}}}function C(R){for(var Q=0;Q<R.length;Q++){if(R[Q].optns.deleted){R.splice(Q,1);Q--}}return R.length}var l={};l.object=function(){this.clone=function(Q){var R=new l[this._proto];l[this._proto].prototype.base.call(R);v(R,this);R.layer(J(this).optns.id);if(Q===undefined){return R}return R.animate(Q)};this.shadow=function(R){for(var S in R){switch(S){case"x":this._shadowX=R.x;break;case"y":this._shadowY=R.y;break;case"blur":this._shadowBlur=R.blur;break;case"color":var Q=i(R.color);this._shadowColor=R.color.val;this._shadowColorR=Q.colorR;this._shadowColorG=Q.colorG;this._shadowColorB=Q.colorB;this._shadowColorA=Q.alpha;break}}e(this);return this};this.setOptns=function(Q){Q.globalAlpha=this._opacity;Q.shadowOffsetX=this._shadowX;Q.shadowOffsetY=this._shadowY;Q.shadowBlur=this._shadowBlur;Q.globalCompositeOperation=this._composite;Q.shadowColor="rgba("+this._shadowColorR+","+this._shadowColorG+","+this._shadowColorB+","+this._shadowColorA+")";if(this.scaleMatrix){this.matrix(g(this.matrix(),this.scaleMatrix));this.scaleMatrix=false}if(this.rotateMatrix){this.matrix(g(this.matrix(),this.rotateMatrix));this.rotateMatrix=false}Q.transform(this._transform11,this._transform12,this._transform21,this._transform22,this._transformdx,this._transformdy);return this};this.up=function(Q){if(Q===undefined){Q=1}if(Q=="top"){Q=J(this).objs.length-1}this._level+=Q;J(this).optns.anyObjLevelChanged=true;e(this);return this};this.down=function(Q){if(Q==undefined){Q=1}if(Q=="bottom"){Q=this._level}this._level-=Q;J(this).optns.anyObjLevelChanged=true;e(this);return this};this.del=function(){this.optns.deleted=true;J(this).optns.anyObjDeleted=true;e(this)};this.focus=function(Q){if(Q===undefined){this.optns.focused=true;if(typeof this.onfocus=="function"){this.onfocus()}}else{this.onfocus=Q}return this};this.blur=function(Q){if(Q===undefined){this.optns.focused=false;if(typeof this.onblur=="function"){this.onblur()}}else{this.onblur=Q}return this};this.click=function(Q){return m.call(this,Q,"click")};this.keypress=function(Q){return O.call(this,Q,"onkeypress")};this.keydown=function(Q){return O.call(this,Q,"onkeydown")};this.keyup=function(Q){return O.call(this,Q,"onkeyup")};this.mousedown=function(Q){return m.call(this,Q,"mousedown")};this.mouseup=function(Q){return m.call(this,Q,"mouseup")};this.mousemove=function(Q){return m.call(this,Q,"mousemove")};this.mouseover=function(Q){return m.call(this,Q,"mouseover")};this.mouseout=function(Q){return m.call(this,Q,"mouseout")};this.attr=function(S,R){if(typeof S==="object"){var Q=S}else{if(R===undefined){return this["_"+S]}Q={};Q[S]=R}return this.animate(Q)};this.stop=function(T,U){this.optns.animated=false;if(U===undefined){U=false}if(T===undefined){T=false}for(var S=0;S<this.animateQueue.length;S++){var Q=this.animateQueue[S];if(U){Q.animateFn.call(this)}if(T){for(var R in Q){if(Q[R]["from"]!==undefined){this[R]=Q[R]["to"];t(R,this,Q)}}}}this.animateQueue=[];return this};this.animate=function(S,W,X,V,U){if(W===undefined){W=1}else{if(typeof W=="function"){U=W;W=1}if(typeof W=="object"){X=W;W=1}}if(W!=1){W=W/1000*F[this.optns.canvas.number].fps}if(X===undefined){X={fn:"linear",type:"in"}}else{if(typeof X=="function"){U=X;X={fn:"linear",type:"in"}}if(X.type===undefined){X.type="in"}}if(V===undefined){V=false}else{if(typeof V=="function"){U=V;V=false}}if(S.scale!==undefined){this._scaleX=this._scaleY=0;if(typeof S.scale!="object"){S.scaleX=S.scaleY=S.scale}else{S.scaleX=S.scale.x||0;S.scaleY=S.scale.y||0}}if(S.translate!==undefined){this._translateX=this._translateY=0;if(typeof S.translate!="object"){S.translateX=S.translateY=S.translate}else{S.translateX=S.translate.x||0;S.translateY=S.translate.y||0}S.translate=undefined}if(S.rotate!==undefined){S.rotateAngle=S.rotate.angle;this._rotateAngle=0;this._rotateX=S.rotate.x||0;this._rotateY=S.rotate.y||0;S.rotate=undefined}if(S.color!==undefined){var R=i(S.color);if(R.color.notColor){this.optns.color.notColor=R.color.notColor}else{S.colorR=R.colorR;S.colorG=R.colorG;S.colorB=R.colorB;S.alpha=R.alpha}S.color=undefined}if(S.shadowColor!==undefined){R=i(S.shadowColor);S.shadowColorR=R.colorR;S.shadowColorG=R.colorG;S.shadowColorB=R.colorB;S.shadowColorA=R.alpha;S.shadowColor=undefined}if(W>1){var Q=this.animateQueue[this.animateQueue.length]={animateKeyCount:0};if(U){Q.animateFn=U}this.optns.animated=true}for(var T in S){if(this["_"+T]!==undefined&&S[T]!==undefined){if(S[T]!=this["_"+T]){if(S[T].charAt){if(S[T].charAt(1)=="="){S[T]=this["_"+T]+parseInt(S[T].charAt(0)+S[T].substr(2))}else{if(!B.test(S[T])){S[T]=parseInt(S[T])}else{this["_"+T]=S[T]}}}if(W==1){this["_"+T]=S[T]}else{Q["_"+T]={from:this["_"+T],to:S[T],duration:W,step:1,easing:X,onstep:V,prev:0};Q.animateKeyCount++}}}}if(W==1){if(S.rotateAngle){this.rotate(this._rotateAngle,this._rotateX,this._rotateY)}if(S.translateX||S.translateY){this.translate(this._translateX,this._translateY)}if(S.scaleX||S.scaleY){this.scale(this._scaleX,this._scaleY)}}e(this);return this};this.matrix=function(Q){if(Q===undefined){return[[this._transform11,this._transform21,this._transformdx],[this._transform12,this._transform22,this._transformdy]]}this._transform11=Q[0][0];this._transform21=Q[0][1];this._transform12=Q[1][0];this._transform22=Q[1][1];this._transformdx=Q[0][2];this._transformdy=Q[1][2];return this};this.translate=function(Q,R){this.matrix(g(this.matrix(),[[1,0,Q],[0,1,R]]));e(this);return this};this.scale=function(Q,R){if(R===undefined){R=Q}if(this.scaleMatrix){this.scaleMatrix=g(this.scaleMatrix,[[Q,0,this._x*(1-Q)],[0,R,this._y*(1-R)]])}else{this.scaleMatrix=[[Q,0,this._x*(1-Q)],[0,R,this._y*(1-R)]]}e(this);return this};this.rotate=function(R,U,V){e(this);R=Math.PI*R/180;var W=Math.cos(R);var T=Math.sin(R);var S=[];if(U===undefined){S=[[W,-T,0],[T,W,0]]}else{if(U=="center"){var Q=N(this);if(V===undefined){U=Q.x;V=Q.y}else{U=Q.x+V.x;V=Q.y+V.y}}S=[[W,-T,-U*(W-1)+V*T],[T,W,-V*(W-1)-U*T]]}if(this.rotateMatrix){this.rotateMatrix=g(this.rotateMatrix,S)}else{this.rotateMatrix=S}return this};this.transform=function(V,U,X,W,S,R,T){if(T!==undefined){this.matrix([[V,X,S],[U,W,R]])}else{var Q=g(this.matrix(),[[V,X,S],[U,W,R]]);this.matrix(Q)}e(this);return this};this.beforeDraw=function(Q){if(!this._visible){return false}Q.save();if(this.optns.clipObject){var R=this.optns.clipObject;R._visible=true;if(R.optns.animated){r.call(R)}R.setOptns(Q);Q.beginPath();R.draw(Q);Q.clip()}this.setOptns(Q);if(this.optns.animated){r.call(this)}Q.beginPath();return true};this.clip=function(Q){if(Q===undefined){return this.optns.clipObject}J(this).objs.splice(Q._level,1);this.optns.clipObject=Q;return this};this.afterDraw=function(Q){Q.ctx.closePath();K(this,Q);Q.ctx.restore();if(this.optns.clipObject){l.shape.prototype.afterDraw.call(this.optns.clipObject,Q)}};this.isPointIn=function(R,V,T){var U=this.optns.canvas.number;var S=F[U].optns.ctx;if(T!==undefined){R-=F[U].optns.x;V-=F[U].optns.y}S.save();S.beginPath();this.draw(S);var Q=u(this,R,V);S.closePath();S.restore();if(Q){return true}return false};this.layer=function(Q){return c(Q,this,"objs")};this.canvas=function(Q){return f(Q,this,"objs")};this.draggable=function(R,V,T){var U=this;var S=this.optns.drag;if(typeof V==="function"){T=V;V=undefined}if(typeof R=="function"){T=R;R=undefined}S.shiftX=0;S.shiftY=0;if(V!==undefined){if(V.shiftX!==undefined){S.shiftX=V.shiftX;V.shiftX=undefined}if(V.shiftY!==undefined){S.shiftY=V.shiftY;V.shiftY=undefined}}if(R!==undefined){if(R.id){U=(V===undefined)?R.visible(false):R.animate(V).visible(false)}if(R=="clone"){U=this.clone(V).visible(false);S.type="clone"}}S.val=true;S.x=this._x;S.y=this._y;S.dx=this._transformdx;S.dy=this._transformdy;S.object=U;S.params=V;S.fn=T||false;var Q=F[this.optns.canvas.number].optns;Q.mousemove.val=true;Q.mousedown.val=true;Q.mouseup.val=true;return this};this.droppable=function(Q){this.optns.drop.val=true;if(Q!==undefined){this.optns.drop.fn=Q}return this};this.name=function(Q){return this.attr("name",Q)};this.visible=function(Q){return this.attr("visible",Q)};this.composite=function(Q){return this.attr("composite",Q)};this.id=function(Q){if(Q===undefined){return this.optns.id}this.optns.id=Q;return this};this.opacity=function(Q){return this.attr("opacity",Q)};this.level=function(Q){if(Q==undefined){return this._level}this._level=Q;J(this).optns.anyObjLevelChanged=true;e(this);return this};this.instanceOf=function(Q){if(Q===undefined){return this._proto}return this instanceof l[Q]};this.base=function(R,S,Q){this.optns={animated:false,clipObject:false,drop:{val:false,fn:function(){}},drag:{val:false},layer:{id:F[D].optns.id+"Layer0",number:0},canvas:{number:0},focused:false};this.animateQueue=[];this._x=R||0;this._y=S||0;if(Q===undefined&&F[D]!==undefined&&F[D].layers[0]!==undefined){this.optns.layer.number=0;this.optns.canvas.number=D;this._level=J(this).objs.length;J(this).objs[this._level]=this;this.optns.layer.id=J(this).optns.id;e(this)}return this};this._visible=true;this._composite="source-over";this._name="";this._opacity=1;this._shadowX=0;this._shadowY=0;this._shadowBlur=0;this._shadowColor="rgba(0,0,0,0)";this._shadowColorR=0;this._shadowColorG=0;this._shadowColorB=0;this._shadowColorA=0;this._translateX=0;this._translateY=0;this._scaleX=0;this._scaleY=0;this._rotateAngle=0;this._rotateX=0;this._rotateY=0;this._transform11=1;this._transform12=0;this._transform21=0;this._transform22=1;this._transformdx=0;this._transformdy=0;this.rotateMatrix=this.scaleMatrix=false};l.shape=function(){this.color=function(Q){if(Q===undefined){return[this._colorR,this._colorG,this._colorB,this._alpha]}return this.attr("color",Q)};this.lineStyle=function(Q){return this.attr(Q)};this.setOptns=function(R){l.shape.prototype.setOptns.call(this,R);R.lineWidth=this._lineWidth;R.lineCap=this._cap;R.lineJoin=this._join;R.miterLimit=this._miterLimit;var S=this.optns.color;if(S.notColor===undefined){S.val="rgba("+parseInt(this._colorR)+","+parseInt(this._colorG)+","+parseInt(this._colorB)+","+parseInt(this._alpha*100)/100+")"}else{var Q=S.notColor;var T=F[Q.canvas].layers[Q.layer];if(T.grdntsnptrns[Q.level]!==undefined){S.val=T.grdntsnptrns[Q.level].val}}if(this._fill){R.fillStyle=S.val}else{R.strokeStyle=S.val}};this.afterDraw=function(Q){if(this._fill){Q.ctx.fill()}else{Q.ctx.stroke()}l.shape.prototype.afterDraw.call(this,Q)};this.base=function(Q,T,R,S){if(R===undefined){R="rgba(0,0,0,1)"}else{if(!R.charAt&&R.id===undefined){S=R;R="rgba(0,0,0,1)"}}l.shape.prototype.base.call(this,Q,T);this._fill=S;this.optns.color={val:R,notColor:undefined};if(R===undefined){return this}return this.color(R)};this._colorR=0;this._colorG=0;this._colorB=0;this._alpha=0;this._lineWidth=1;this._cap="butt";this._join="miter";this._miterLimit=1};l.shape.prototype=new l.object;l.lines=function(){this.addPoint=function(){e(this);var R=this.pointNames;for(var Q=0;Q<R.length;Q++){this[R[Q]+this.shapesCount]=arguments[Q]}this.shapesCount++;return this};this.delPoint=function(R,U,Q){e(this);if(U===undefined){var T=this.points();T.splice(R,1);this.points(T)}else{Q=Q||0;for(var S=0;S<this.shapesCount;S++){if(this["_x"+S]<R+Q&&this["_x"+S]>R-Q&&this["_y"+S]<U+Q&&this["_y"+S]<U+Q){this.delPoint(S);S--}}}return this};this.points=function(T){var U=this.pointNames;if(T===undefined){T=[];for(var R=0;R<this.shapesCount;R++){T[R]=[];for(var S=0;S<U.length;S++){T[R][S]=this[U[S]+R]}}return T}e(this);var Q=this.shapesCount;this.shapesCount=T.length;for(R=0;R<this.shapesCount;R++){for(S=0;S<U.length;S++){this[U[S]+R]=T[R][S]}}for(R=this.shapesCount;R<Q;R++){for(S=0;S<U.length;S++){this[U[S]+R]=undefined}}return this};this.base=function(Q,R){l.lines.prototype.base.call(this,0,0,Q,R);this.shapesCount=0;return this}};l.lines.prototype=new l.shape;l.line=function(){this.draw=function(Q){if(this._x0===undefined){return}Q.moveTo(this._x0,this._y0);for(var R=1;R<this.shapesCount;R++){Q.lineTo(this["_x"+R],this["_y"+R])}};this.base=function(R,Q,S){l.line.prototype.base.call(this,Q,S);if(R!==undefined){this.points(R)}return this};this._proto="line";this.pointNames=["_x","_y"]};l.line.prototype=new l.lines;l.qCurve=function(){this.draw=function(Q){if(this._x0===undefined){return}Q.moveTo(this._x0,this._y0);for(var R=1;R<this.shapesCount;R++){Q.quadraticCurveTo(this["_cp1x"+R],this["_cp1y"+R],this["_x"+R],this["_y"+R])}};this.base=function(R,Q,S){l.qCurve.prototype.base.call(this,Q,S);if(R!==undefined){this.points(R)}return this};this._proto="qCurve";this.pointNames=["_x","_y","_cp1x","_cp1y"]};l.qCurve.prototype=new l.lines;l.bCurve=function(){this.draw=function(Q){if(this._x0===undefined){return}Q.moveTo(this._x0,this._y0);for(var R=1;R<this.shapesCount;R++){Q.bezierCurveTo(this["_cp1x"+R],this["_cp1y"+R],this["_cp2x"+R],this["_cp2y"+R],this["_x"+R],this["_y"+R])}};this.base=function(R,Q,S){l.bCurve.prototype.base.call(this,Q,S);if(R!==undefined){this.points(R)}return this};this._proto="bCurve";this.pointNames=["_x","_y","_cp1x","_cp1y","_cp2x","_cp2y"]};l.bCurve.prototype=new l.lines;l.circle=function(){this.draw=function(Q){Q.arc(this._x,this._y,this._radius,0,p,true)};this.base=function(R,U,Q,S,T){l.circle.prototype.base.call(this,R,U,S,T);this._radius=Q;return this};this._proto="circle"};l.circle.prototype=new l.shape;l.rect=function(){this.draw=function(Q){Q.rect(this._x,this._y,this._width,this._height)};this.base=function(R,V,T,Q,S,U){l.rect.prototype.base.call(this,R,V,S,U);this._width=T;this._height=Q;return this};this._proto="rect"};l.rect.prototype=new l.shape;l.arc=function(){this.draw=function(Q){Q.arc(this._x,this._y,this._radius,this._startAngle,this._endAngle,this._anticlockwise)};this.base=function(R,X,Q,U,T,V,S,W){if(V!==undefined){if(V.charAt){S=V}}l.arc.prototype.base.call(this,R,X,S,W);this._radius=Q;this._startAngle=U;this._endAngle=T;this._anticlockwise=V||true;return this};this._proto="arc"};l.arc.prototype=new l.shape;l.text=function(){this.font=function(Q){return this.attr("font",Q)};this._font="10px sans-serif";this.align=function(Q){return this.attr("align",Q)};this._align="start";this.baseline=function(Q){return this.attr("baseline",Q)};this._baseline="alphabetic";this.setOptns=function(Q){l.text.prototype.setOptns.call(this,Q);Q.textBaseline=this._baseline;Q.font=this._font;Q.textAlign=this._align};this.draw=function(Q){if(this._maxWidth==false){if(this._fill){Q.fillText(this._string,this._x,this._y)}else{Q.strokeText(this._string,this._x,this._y)}}else{if(this._fill){Q.fillText(this._string,this._x,this._y,this._maxWidth)}else{Q.strokeText(this._string,this._x,this._y,this._maxWidth)}}};this.base=function(S,Q,V,T,R,U){if(T!==undefined){if(T.charAt){if(R!==undefined){U=R}R=T;T=false}}l.text.prototype.base.call(this,Q,V,R,U||1);this._string=S;this._maxWidth=T||false;return this};this._proto="text"};l.text.prototype=new l.shape;l.grdntsnptrn=function(){this.layer=function(R){return c(R,this,"grdntsnptrns")};this.canvas=function(R){return f(R,this,"grdntsnptrns")};var Q=new l.object;this.animate=Q.animate;this.attr=Q.attr;this.id=Q.id;this.name=Q.name;this.level=Q.level;this.base=function(){this.animateQueue=[];this.optns={animated:false,name:"",layer:{id:F[0].optns.id+"Layer_0",number:0},canvas:{number:0},visible:true};this.optns.layer.id=F[D].optns.id+"Layer_0";this.optns.layer.number=0;this.optns.canvas.number=D;this._level=F[D].layers[0].grdntsnptrns.length;F[D].layers[0].grdntsnptrns[this._level]=this;e(this)};return this};l.gradients=function(){this.colorStopsCount=0;this.paramNames=["_pos","_colorR","_colorG","_colorB","_alpha"];this.addColorStop=function(T,R){e(this);var Q=i(R);var S=this.colorStopsCount;this["_pos"+S]=T;this["_colorR"+S]=Q.colorR;this["_colorG"+S]=Q.colorG;this["_colorB"+S]=Q.colorB;this["_alpha"+S]=Q.alpha;this.colorStopsCount++;return this};this.animate=function(U,W,X,V,T){for(var S in U){if(S.substr(0,5)=="color"){var R=S.substring(5);var Q=i(U[S]);U["colorR"+R]=Q.colorR.val;U["colorG"+R]=Q.colorG.val;U["colorB"+R]=Q.colorB.val;U["alpha"+R]=Q.alpha.val}}l.gradients.prototype.animate.call(this,U,W,X,V,T)};this.delColorStop=function(R){e(this);var Q=this.colorStops();Q.splice(R,1);if(Q.length>0){this.colorStops(Q)}else{this.colorStopsCount=0}return this};this.colorStops=function(V){var U=this.paramNames;if(V===undefined){V=[];for(var S=0;S<this.colorStopsCount;S++){V[S]=[];for(var T=0;T<U.length;T++){V[S][T]=this[U[T]+S]}}return V}e(this);var R=this.colorStopsCount;var Q=V.length;if(V[0].length==2){for(S=0;S<Q;S++){this.addColorStop(V[S][0],V[S][1])}}else{for(S=0;S<Q;S++){for(T=0;T<U.length;T++){this[U[T]+S]=V[S][T]}}}for(S=Q;S<R;S++){for(T=0;T<U.length;T++){this[U[T]+S]=undefined}}this.colorStopsCount=Q;return this};this.base=function(Q){l.gradients.prototype.base.call(this);if(Q==undefined){return this}else{return this.colorStops(Q)}}};l.gradients.prototype=new l.grdntsnptrn;l.pattern=function(){this.create=function(Q){if(this.optns.animated){r.call(this)}this.val=Q.createPattern(this._img,this._type)};this.base=function(Q,R){l.pattern.prototype.base.call(this);this._img=Q;this._type=R||"repeat";return this};this._proto="pattern"};l.pattern.prototype=new l.grdntsnptrn;l.lGradient=function(){this.create=function(Q){if(this.optns.animated){r.call(this)}this.val=Q.createLinearGradient(this._x1,this._y1,this._x2,this._y2);for(var R=0;R<this.colorStopsCount;R++){this.val.addColorStop(this["_pos"+R],"rgba("+parseInt(this["_colorR"+R])+","+parseInt(this["_colorG"+R])+","+parseInt(this["_colorB"+R])+","+this["_alpha"+R]+")")}};this.base=function(S,U,R,T,Q){l.lGradient.prototype.base.call(this,Q);this._x1=S;this._y1=U;this._x2=R;this._y2=T;return this};this._proto="lGradient"};l.lGradient.prototype=new l.gradients;l.rGradient=function(){this.create=function(Q){if(this.optns.animated){r.call(this)}this.val=Q.createRadialGradient(this._x1,this._y1,this._r1,this._x2,this._y2,this._r2);for(var R=0;R<this.colorStopsCount;R++){this.val.addColorStop(this["_pos"+R],"rgba("+parseInt(this["_colorR"+R])+","+parseInt(this["_colorG"+R])+","+parseInt(this["_colorB"+R])+","+this["_alpha"+R]+")")}};this.base=function(U,W,T,S,V,R,Q){l.rGradient.prototype.base.call(this,Q);this._x1=U;this._y1=W;this._r1=T;this._x2=S;this._y2=V;this._r2=R;return this};this._proto="rGradient"};l.rGradient.prototype=new l.gradients;l.layer=function(){this.canvas=function(R){if(R===undefined){return this.idCanvas}if(this.optns.canvas.id==R){return this}var U=-1;var Q=0;for(var T=0;T<F.length;T++){if(F[T].optns.id==R){U=T}if(F[T].optns.id==this.optns.canvas.id){Q=T}}if(U<0){U=F.length;x.canvas(R)}this.optns.canvas.id=R;this.optns.canvas.number=U;F[Q].layers.splice(this._level,1);this._level=F[U].layers.length;F[U].layers[this._level]=this;for(T=0;T<this.objs.length;T++){var S=this.objs[T].optns;S.layer.number=this._level;S.canvas.number=U}F[this.optns.canvas.number].optns.redraw=1;return this};this.up=function(S){if(S===undefined){S=1}if(S=="top"){S=objs[this._layer].length-1}this._level+=S;for(var R=0;R<this.objs.length;R++){this.objs[R].optns.layer.number=this._level}var Q=F[this.optns.canvas.number].optns;Q.anyLayerLevelChanged=true;Q.redraw=1;return this};this.down=function(S){if(S==undefined){S=1}if(S=="bottom"){S=this._level}this._level-=S;for(var R=0;R<this.objs.length;R++){this.objs[R].options.layer.number=this._level}var Q=F[this.optns.canvas.number].optns;Q.anyLayerLevelChanged=true;Q.redraw=1;return this};this.del=function(){var Q=F[this.optns.canvas.number].optns;Q.anyLayerDeleted=true;this.draw=false;Q.redraw=1;return};this.setOptns=function(Q){Q.setTransform(1,0,0,1,0,0);l.layer.prototype.setOptns.call(this,Q);return this};this.afterDraw=function(Q){Q.ctx.closePath();Q.ctx.restore();if(this.optns.clipObject){l.layer.prototype.afterDraw.call(this.optns.clipObject,Q)}};this.clone=function(S,Q){var R=x.layer(S);v(R,this);R.canvas(F[this.optns.canvas.number].optns.id);if(Q===undefined){return R}return R.animate(Q)};this.isPointIn=function(Q,T,S){for(var R=0;R<this.objs.length;R++){if(this.objs[R].isPointIn(Q,T,S)){return true}}return false};this.draw=function(U){var T=this.grdntsnptrns.length;var Q=this.objs.length;for(var S=0;S<T;S++){this.grdntsnptrns[S].create(U.ctx)}if(this.optns.anyObjLevelChanged){A(this.objs);this.optns.anyObjLevelChanged=false}if(this.optns.anyObjDeleted){Q=C(this.objs);this.optns.anyObjDeleted=false}U.ctx.globalCompositeOperation=this.optns.gCO;for(S=0;S<Q;S++){var R=this.objs[S];if(typeof(R.draw)=="function"){this.setOptns(U.ctx);if(R.beforeDraw(U.ctx)){if(typeof(R.draw)=="function"){R.draw(U.ctx);R.afterDraw(U)}}}}};this.base=function(R){l.layer.prototype.base.call(this,0,0,true);var Q=F[D].layers.length;F[D].layers[Q]=this;this.objs=[];this.grdntsnptrns=[];this._level=Q;this.optns.id=R;this.optns.anyObjDeleted=false;this.optns.anyObjLevelChanged=false;this.optns.gCO=F[D].optns.gCO;this.optns.canvas.id=F[D].optns.id;this.optns.canvas.number=D;return this};this._proto="layer"};l.layer.prototype=new l.object;function E(R){var Q=new l.layer();return Q.base(R)}l.imageData=function(){this.setPixel=function(R,U,S){var Q=i(S);var T=(R+U*this._width)*4;this.data[T+0]=Q.colorR;this.data[T+1]=Q.colorG;this.data[T+2]=Q.colorB;this.data[T+3]=Q.alpha*255;e(this);return this};this.getPixel=function(Q,S){var R=(Q+S*this._width)*4;return[this.data[R+0],this.data[R+1],this.data[R+2],this.data[R+3]/255]};this._getX=0;this._getY=0;this.getData=function(R,V,T,Q){this._getX=R;this._getY=V;this._width=T;this._height=Q;var S=F[this.optns.canvas.number].optns.ctx;try{this.imgData=S.getImageData(this._getX,this._getY,this._width,this._height)}catch(U){netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");this.imgData=S.getImageData(this._getX,this._getY,this._width,this._height)}this.data=this.imgData.data;e(this);return this};this.putData=function(Q,R){if(Q!==undefined){this._x=Q}if(R!==undefined){this._y=R}this._putData=true;e(this);return this};this.draw=function(Q){if(this.imgData===undefined){this.imgData=Q.createImageData(this._width,this._height);for(var R=0;R<this._width*this._height*4;R++){this.imgData.data[R]=this.data[R]}this.data=this.imgData.data}if(this._putData){Q.putImageData(this.imgData,this._x,this._y)}};this.base=function(U,Q){l.imageData.prototype.base.call(this);if(Q===undefined){var V=U;U=V._width;Q=V._height}this._width=U;this._height=Q;this.data=[];for(var T=0;T<this._width;T++){for(var S=0;S<this._height;S++){var R=(T+S*this._width)*4;this.data[R+0]=0;this.data[R+1]=0;this.data[R+2]=0;this.data[R+3]=0}}return this};this._putData=false;this._proto="imageData"};l.imageData.prototype=new l.object;l.image=function(){this.draw=function(Q){if(this._swidth==false&&this._dx==false){Q.drawImage(this._img,this._sx,this._sy)}else{if(this._dx==false){Q.drawImage(this._img,this._sx,this._sy,this._swidth,this._sheight)}else{Q.drawImage(this._img,this._sx,this._sy,this._swidth,this._sheight,this._dx,this._dy,this._dwidth,this._dheight)}}};this.base=function(T,V,U,S,R,Y,X,W,Q){l.image.prototype.base.call(this);this._img=T;this._swidth=S||false;this._sheight=R||false;this._sx=V;this._sy=U;this._dx=Y||false;this._dy=X||false;this._dwidth=W||false;this._dheight=Q||false;return this};this._proto="image"};l.image.prototype=new l.object;l.groups=function(){for(var Q in l){if(Q=="group"||Q=="groups"){continue}var S=new l[Q];for(var R in S){if(typeof S[R]=="function"&&this[R]===undefined){this[R]=function(){var V=[];for(var U=0;U<this.elements.length;U++){var T=this.elements[U];v(V,arguments);if(typeof T[arguments.callee.val]=="function"){T[arguments.callee.val].apply(T,V)}}return this};this[R].val=R}}}this.base=function(){this.elements=[];return this}};l.group=function(){this._proto="group"};l.group.prototype=new l.groups;function s(){var Q=new l.group;return Q.base()}x.addObject=function(R,S,Q){l[R]=function(T){this.draw=l[T].draw;this.base=l[T].base;this._proto=T};l[R].prototype=new l.shape;l[R].draw=Q;l[R].base=function(U,X,T){l[U].prototype.base.call(this,X.x||0,X.y||0,X.color||"rgba(0,0,0,0)",X.fill||1);var W=0;for(var V in X){this["_"+V]=T[W]||X[V];if(V=="color"){this.color(T[W]||X[V])}W++}return this};x[R]=function(){var U=arguments.callee.val;var T=new l[U](U);return T.base(U,arguments.callee.parameters,arguments)};x[R].val=R;x[R].parameters=S};x.addAnimateFunction=function(Q,R){d[Q]=R};x.clear=function(Q){if(F[0]===undefined){return}if(Q===undefined){F[0].clear();return}x.canvas(Q).clear()};x.pause=function(Q){if(Q===undefined){F[0].pause();return}x.canvas(Q).pause()};x.start=function(Q,R){x.canvas(Q).start(R)};x.pattern=function(Q,R){var S=new l.pattern;return S.base(Q,R)};x.lGradient=function(S,U,R,T,Q){var V=new l.lGradient;return V.base(S,U,R,T,Q)};x.rGradient=function(U,W,T,S,V,R,Q){var X=new l.rGradient;return X.base(U,W,T,S,V,R,Q)};x.line=function(S,R,T){var Q=new l.line;return Q.base(S,R,T)};x.qCurve=function(S,Q,T){var R=new l.qCurve;return R.base(S,Q,T)};x.bCurve=function(R,Q,T){var S=new l.bCurve;return S.base(R,Q,T)};x.imageData=function(R,Q){var S=new l.imageData;return S.base(R,Q)};x.image=function(U,W,V,T,R,Z,Y,X,Q){var S=new l.image;return S.base(U,W,V,T,R,Z,Y,X,Q)};x.circle=function(R,V,Q,S,U){var T=new l.circle;return T.base(R,V,Q,S,U)};x.rect=function(R,W,T,Q,S,V){var U=new l.rect;return U.base(R,W,T,Q,S,V)};x.arc=function(X,W,U,V,R,S,T,Y){var Q=new l.arc;return Q.base(X,W,U,V,R,S,T,Y)};x.text=function(S,Q,W,T,R,U){var V=new l.text;return V.base(S,Q,W,T,R,U)};x.canvas=function(R){if(R===undefined){return F[0]}var Q=F.length;for(var T=0;T<Q;T++){if(F[T].optns.id==R){return F[T]}}var S={id:function(U){if(U===undefined){return this.optns.id}this.optns.id=U;return this}};F[Q]=S;D=Q;S.cnv=document.getElementById(R);if("\v"=="v"){G_vmlCanvasManager.initElement(S.cnv)}S.optns={id:R,number:D,ctx:S.cnv.getContext("2d"),width:S.cnv.offsetWidth,height:S.cnv.offsetHeight,anyLayerDeleted:false,anyLayerLevelChanged:false,keyDown:{val:false,code:false},keyUp:{val:false,code:false},keyPress:{val:false,code:false},mousemove:{val:false,x:false,y:false,object:false},click:{val:false,x:false,y:false,object:false},mouseup:{val:false,x:false,y:false,object:false},mousedown:{val:false,x:false,y:false,object:false},drag:{object:false,x:0,y:0},gCO:"source-over",redraw:1};S.layers=[];S.interval=0;x.layer(R+"Layer_0").canvas(R);S.start=function(V){D=this.layers[0].optns.canvas.number;if(V){if(this.interval){return this}this.fps=V;var W=o(this.cnv);this.optns.x=W.left;this.optns.y=W.top;var U=F[this.optns.number];this.cnv.onclick=function(X){if(!U.optns.click.val){return}k(X,"click",U.optns)};this.cnv.onmousedown=function(X){if(!U.optns.mousedown.val){return}k(X,"mousedown",U.optns)};this.cnv.onmouseup=function(X){if(!U.optns.mouseup.val){return}k(X,"mouseup",U.optns)};this.cnv.onkeyup=function(X){H(X,"keyUp",U.optns)};this.cnv.onkeydown=function(X){H(X,"keyDown",U.optns)};this.cnv.onkeypress=function(X){H(X,"keyPress",U.optns)};this.cnv.onmouseout=this.cnv.onmousemove=function(Z){if(!U.optns.mousemove.val){return}k(Z,"mousemove",U.optns);if(U.optns.drag.object!=false){var Y=U.optns.drag;var X=G(U.optns.mousemove.x,U.optns.mousemove.y,Y.object.matrix());Y.object.transform(1,0,0,1,X.x-Y.x,X.y-Y.y);if(Y.fn){Y.fn.call(Y.object,({x:U.optns.mousemove.x,y:U.optns.mousemove.y}))}}};this.interval=setInterval(function(){x.canvas(R).frame()},this.fps)}else{this.frame()}return this};S.pause=function(){clearInterval(this.interval);this.interval=0};S.clear=function(){clearInterval(this.interval);this.interval=0;this.layers=[];x.layer(this.optns.id+"Layer_0").canvas(this.optns.id);this.optns.ctx.clearRect(0,0,this.optns.width,this.optns.height);this.optns.redraw++;return this};S.frame=function(){var U=this.optns;if(!U.redraw){return}U.redraw--;U.ctx.clearRect(0,0,U.width,U.height);var X=this.layers.length;if(X==0){return}if(U.anyLayerLevelChanged){A(this.layers);U.anyLayerLevelChanged=false}if(U.anyLayerDeleted){X=C(this.layers);U.anyLayerDeleted=false}for(var Y=0;Y<X;Y++){var W=this.layers[Y];if(typeof(W.draw)=="function"){if(W.beforeDraw(U.ctx)){if(typeof(W.draw)=="function"){W.draw(U);W.afterDraw(U)}}}}if(U.mousemove.x!=false){if(U.mousemove.object!=false){var V=U.mousemove.object;if(w===V){if(typeof V.onmousemove=="function"){V.onmousemove(this.optns.point)}}else{if(w==false){if(typeof V.onmouseover=="function"){V.onmouseover()}}else{if(typeof w.onmouseout=="function"){w.onmouseout()}if(typeof V.onmouseover=="function"){V.onmouseover()}}w=V}}else{if(w!==false){if(typeof w.onmouseout=="function"){w.onmouseout()}w=false}}}if(U.mousedown.object!=false){var aa=this.optns.mousedown;var ad=[aa.object,J(aa.object)];for(Y=0;Y<2;Y++){if(typeof ad[Y].onmousedown=="function"){ad[Y].onmousedown({x:aa.x,y:aa.y})}if(ad[Y].optns.drag.val==true){var Z=U.drag;Z.object=ad[Y].optns.drag.object.visible(true);Z.fn=ad[Y].optns.drag.fn;Z.init=ad[Y];if(Z.init.optns.drag.params!==undefined){Z.object.animate(Z.init.optns.drag.params)}var ae=G(aa.x,aa.y,Z.object.matrix());Z.x=ae.x;Z.y=ae.y;if(Z.object!=Z.init&&Z.init.optns.drag.type!="clone"){ae.x=-Z.object._x+ae.x;ae.y=-Z.object._y+ae.y;Z.x-=ae.x;Z.y-=ae.y;Z.object.transform(1,0,0,1,ae.x,ae.y)}Z.object._transformdx+=Z.init.optns.drag.shiftX;Z.object._transformdy+=Z.init.optns.drag.shiftY}}aa.object=false}if(U.mouseup.object!=false){var ab=U.mouseup;var ag=[ab.object,J(ab.object)];Z=U.drag;for(Y=0;Y<2;Y++){if(typeof ag[Y].onmouseup=="function"){ag[Y].onmouseup({x:ab.x,y:ab.y})}if(ag[Y].optns.drop.val==true&&U.drag.init!==undefined){if(Z.init==Z.object){Z.init.visible(true)}if(typeof ag[Y].optns.drop.fn=="function"){ag[Y].optns.drop.fn.call(ag[Y],Z.init)}this.optns.drag={object:false,x:0,y:0}}else{if(Z.init!==undefined){Z.object.visible(false);Z.init.visible(true);Z.init._transformdx=Z.object._transformdx;Z.init._transformdy=Z.object._transformdy;if(Z.object!=Z.init){Z.object.visible(false)}this.optns.drag={object:false,x:0,y:0}}}}ab.object=false}if(this.optns.click.object!=false){var af=this.optns.click;var ac=[af.object,J(af.object)];for(Y=0;Y<2;Y++){if(typeof ac[Y].onclick=="function"){ac[Y].onclick({x:af.x,y:af.y})}}af.object=false}this.optns.mousemove.object=this.optns.keyUp.val=this.optns.keyDown.val=this.optns.keyPress.val=this.optns.click.x=this.optns.mouseup.x=this.optns.mousedown.x=this.optns.mousemove.x=false};return S};x.layer=function(T){if(T===undefined){return F[0].layers[0]}var Q=0;for(var S=0;S<F.length;S++){Q=F[S].layers.length;for(var R=0;R<Q;R++){if(F[S].layers[R].optns.id==T){return F[S].layers[R]}}}return E(T)};window.jCanvaScript=window.jc=x})();
