Ext.ns("Ax");Ax.animation={name:"Untitled Production",markup:{}};Ext.onReady(function(){Ext.get("loading-msg").update("Initializing...");Ext.QuickTips.init()});Ax.set_version=function(A){Ax.v=A;if(window.developer==true){Ax.title=[Ax.v.app,Ax.v.release,Ax.v.stability,"Development"].join(" ")}else{if(Ax.v.dev==true){Ax.title=[Ax.v.app,Ax.v.release,Ax.v.stability,"Testing build",Ax.v.build].join(" ")}else{Ax.title=[Ax.v.app,Ax.v.release,Ax.v.stability].join(" ")}}document.title=Ax.title};Ax.set_version({app:"Ajax Animator",build:513,release:"0.20.02",dev:false,stability:"Beta RC3",date:1218811348.38});Ext.BLANK_IMAGE_URL="http://ajaxanimator.googlecode.com/svn-history/r444/trunk/ajaxanimator/theme/images/default/s.gif";Ax.files={userlist:"../server/user/userlist.php",test:"../server/user/test.php",animations:"../server/user/animation.php?id=",library:"../server/user/library.php",libraryitem:"../server/user/libraryitem.php?id=",save_proxy:"../server/user/save_proxy.php",open_proxy:"../server/user/open_proxy.php",export_gif:"../server/export/gif.php",export_swf:"../server/export/swf.php",faq:"../server/doc/faq.htm",manual:"../server/doc/manual.htm",themes:"http://ajaxanimator.googlecode.com/svn-history/r444/trunk/ajaxanimator/theme/css/"};Ext.ux.base64={base64s:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",encode:function(C){if(typeof btoa==="function"){return btoa(C)}var F=this.base64s;var B;var E;var A=0;var D="";while(C.length>=A+3){B=(C.charCodeAt(A++)&255)<<16|(C.charCodeAt(A++)&255)<<8|C.charCodeAt(A++)&255;D+=F.charAt((B&16515072)>>18)+F.charAt((B&258048)>>12)+F.charAt((B&4032)>>6)+F.charAt((B&63))}if(C.length-A>0&&C.length-A<3){E=Boolean(C.length-A-1);B=((C.charCodeAt(A++)&255)<<16)|(E?(C.charCodeAt(A)&255)<<8:0);D+=F.charAt((B&16515072)>>18)+F.charAt((B&258048)>>12)+(E?F.charAt((B&4032)>>6):"=")+"="}return(D)},decode:function(C){if(typeof atob==="function"){return atob(C)}var E=this.base64s;var D;var A="";var B=0;for(;B<C.length;B+=4){D=(E.indexOf(C.charAt(B))&255)<<18|(E.indexOf(C.charAt(B+1))&255)<<12|(E.indexOf(C.charAt(B+2))&255)<<6|E.indexOf(C.charAt(B+3))&255;A+=String.fromCharCode((D&16711680)>>16,(D&65280)>>8,D&255)}if(C.charCodeAt(B-2)==61){return(A.substring(0,A.length-2))}else{if(C.charCodeAt(B-1)==61){return(A.substring(0,A.length-1))}else{return(A)}}}};Ext.ux.clone=function(C){if(!C||"object"!==typeof C){return C}var D="function"===typeof C.pop?[]:{};var B,A;for(B in C){if(C.hasOwnProperty(B)){A=C[B];if(A&&"object"===typeof A){D[B]=Ext.ux.clone(A)}else{D[B]=A}}}return D};Ext.namespace("Ext.ux","Ext.ux.Crypto");Ext.ux.Crypto.SHA1=function(){var B=function(D,C,F,E){switch(D){case 0:return(C&F)^(~C&E);case 1:return C^F^E;case 2:return(C&F)^(C&E)^(F&E);case 3:return C^F^E}};var A=function(C,D){return(C<<D)|(C>>>(32-D))};return{hash:function(E){var H=[1518500249,1859775393,2400959708,3395469782];E+=String.fromCharCode(128);var S=Math.ceil(E.length/4)+2;var F=Math.ceil(S/16);var G=new Array(F);for(var V=0;V<F;V++){G[V]=new Array(16);for(var U=0;U<16;U++){G[V][U]=(E.charCodeAt(V*64+U*4)<<24)|(E.charCodeAt(V*64+U*4+1)<<16)|(E.charCodeAt(V*64+U*4+2)<<8)|(E.charCodeAt(V*64+U*4+3))}}G[F-1][14]=((E.length-1)*8)/Math.pow(2,32);G[F-1][14]=Math.floor(G[F-1][14]);G[F-1][15]=((E.length-1)*8)&4294967295;var P=1732584193;var O=4023233417;var L=2562383102;var J=271733878;var I=3285377520;var C=new Array(80);var g,f,Z,Y,X;for(var V=0;V<F;V++){for(var Q=0;Q<16;Q++){C[Q]=G[V][Q]}for(var Q=16;Q<80;Q++){C[Q]=A(C[Q-3]^C[Q-8]^C[Q-14]^C[Q-16],1)}g=P;f=O;Z=L;Y=J;X=I;for(var Q=0;Q<80;Q++){var R=Math.floor(Q/20);var D=(A(g,5)+B(R,f,Z,Y)+X+H[R]+C[Q])&4294967295;X=Y;Y=Z;Z=A(f,30);f=g;g=D}P=(P+g)&4294967295;O=(O+f)&4294967295;L=(L+Z)&4294967295;J=(J+Y)&4294967295;I=(I+X)&4294967295}return P.toHexStr()+O.toHexStr()+L.toHexStr()+J.toHexStr()+I.toHexStr()}}}();Ext.applyIf(Number.prototype,{toHexStr:function(){var C="",A;for(var B=7;B>=0;B--){A=(this>>>(B*4))&15;C+=A.toString(16)}return C}});Ext.ux.ThemeMenu=function(A){Ext.ux.ThemeMenu.superclass.constructor.call(this,A);for(var B=0;B<this.themeconfig.length;B++){this.add(new Ext.menu.CheckItem({text:this.themeconfig[B][1],theme:B,checked:(this.themeconfig[B][2]==true),group:"thememenu",checkHandler:function(D,C){if(C){D.parentMenu.setTheme(D.theme)}}}))}};Ext.extend(Ext.ux.ThemeMenu,Ext.menu.Menu,{cssPath:Ax.files.themes,themeconfig:[["xtheme-default.css","Ext Blue Theme",true],["xtheme-gray.css","Gray Theme"],["xtheme-gray.css,xtheme-gray-extend.css","Extended Gray Theme"],["xtheme-darkgray.css","Dark Gray Theme"],["xtheme-black.css","Black Theme"],["xtheme-olive.css","Olive Theme"],["xtheme-purple.css","Purple Theme"],["xtheme-slate.css","Slate Theme"],["xtheme-peppermint.css","Peppermint Theme"],["xtheme-chocolate.css","Chocolate Theme"],["xtheme-slickness.css","SlicknesS Theme"],["xtheme-pink.css","Pink Theme"],["xtheme-midnight.css","Midnight Theme"],["xtheme-green.css","Green Theme"],["xtheme-indigo.css","Indigo Theme"],["xtheme-silverCherry.css","Silver Cherry Theme"],["xtheme-orange.css","Orange Theme"]],setTheme:function(D){var C=this.themeconfig[D][0];var A=C.split(",");for(var B=0;B<4;B++){if(A[B]){Ext.util.CSS.swapStyleSheet("csstheme"+B,this.cssPath+A[B])}else{Ext.util.CSS.removeStyleSheet("csstheme"+B)}}}});Ext.ux.ToastWindowMgr={positions:[]};Ext.ux.ToastWindow=Ext.extend(Ext.Window,{initComponent:function(){Ext.apply(this,{iconCls:this.iconCls||"information",width:200,height:100,delay:this.delay?this.delay:4000,autoScroll:true,autoDestroy:true,plain:false});this.task=new Ext.util.DelayedTask(this.hide,this);Ext.ux.ToastWindow.superclass.initComponent.call(this)},setMessage:function(A){this.body.update(A)},setTitle:function(B,A){Ext.ux.ToastWindow.superclass.setTitle.call(this,B,A||this.iconCls)},onRender:function(B,A){Ext.ux.ToastWindow.superclass.onRender.call(this,B,A)},onDestroy:function(){Ext.ux.ToastWindowMgr.positions.remove(this.pos);Ext.ux.ToastWindow.superclass.onDestroy.call(this)},afterShow:function(){Ext.ux.ToastWindow.superclass.afterShow.call(this);this.on("move",function(){Ext.ux.ToastWindowMgr.positions.remove(this.pos);this.task.cancel()},this);this.task.delay(this.delay)},animShow:function(){this.pos=0;while(Ext.ux.ToastWindowMgr.positions.indexOf(this.pos)>-1){this.pos++}Ext.ux.ToastWindowMgr.positions.push(this.pos);this.setSize(200,100);this.el.alignTo(document,"br-br",[-20,-20-((this.getSize().height+10)*this.pos)]);this.el.slideIn("b",{duration:1,callback:this.afterShow,scope:this})},animHide:function(){Ext.ux.ToastWindowMgr.positions.remove(this.pos);this.el.ghost("b",{duration:1,remove:true,scope:this,callback:this.destroy})},focus:Ext.emptyFn});Ext.ns("Ext.ux.grid");Ext.ux.grid.CellActions=function(A){Ext.apply(this,A);this.addEvents("action","beforeaction");Ext.ux.grid.CellActions.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.CellActions,Ext.util.Observable,{actionEvent:"click",actionWidth:20,tpl:'<div class="ux-cell-value" style="padding-left:{padding}px"><tpl if="\'left\'!==align">{value}</tpl><div class="ux-cell-actions<tpl if="\'left\'===align"> ux-cell-actions-left</tpl>" style="width:{width}px"><tpl for="actions"><div class="ux-cell-action {cls}" qtip="{qtip}" style="{style}">&#160;</div></tpl></div><tpl if="\'left\'===align">{value}</tpl><div>',userProcessing:Ext.emptyFn,init:function(B){this.grid=B;B.afterRender=B.afterRender.createSequence(this.onRenderGrid,this);var A=this.grid.getColumnModel();Ext.each(A.config,function(D,C){if("object"===typeof D.cellActions){D.origRenderer=A.getRenderer(C);D.renderer=this.renderActions.createDelegate(this)}},this)},onRenderGrid:function(){this.view=this.grid.getView();var A={scope:this};A[this.actionEvent]=this.onClick;this.view.mainBody.on(A)},getData:function(E,A,B,F,D,C){return B.data||{}},renderActions:function(F,H,D,I,B,G){var E=this.grid.getColumnModel().config[B];var A=E.origRenderer(F,H,D,I,B,G);if(E.cellActions&&!E.actionsTpl){E.actionsTpl=this.processActions(E);E.actionsTpl.compile()}else{if(!E.cellActions){return A}}var C=this.getData.apply(this,arguments);C.value=A;return E.actionsTpl.apply(C)},processActions:function(C){this.callbacks=this.callbacks||{};var B={align:this.align||"right",width:this.actionWidth*C.cellActions.length,padding:"left"===this.align?this.actionWidth*C.cellActions.length:0,value:"{value}",actions:[]};Ext.each(C.cellActions,function(D,E){if(D.iconCls&&"function"===typeof (D.callback||D.cb)){this.callbacks[D.iconCls]=D.callback||D.cb}var F={cls:D.iconIndex?"{"+D.iconIndex+"}":(D.iconCls?D.iconCls:""),qtip:D.qtipIndex?"{"+D.qtipIndex+"}":(D.tooltip||D.qtip?D.tooltip||D.qtip:""),style:D.style?D.style:""};B.actions.push(F)},this);this.userProcessing(C,B);var A=new Ext.XTemplate(this.tpl);return new Ext.Template(A.apply(B))},onClick:function(D,E){var I=D.getTarget("div.ux-cell-action");var J=D.getTarget(".x-grid3-row");var A=this.view.findCellIndex(E.parentNode.parentNode);var F=this.grid.getColumnModel().config[A];var C,G,H,B;if(I){C=this.grid.store.getAt(J.rowIndex);G=F.dataIndex;H=C.get(G);B=I.className.replace(/ux-cell-action /,"")}if(false!==J&&false!==A&&C&&G&&B){if(this.callbacks&&"function"===typeof this.callbacks[B]){this.callbacks[B](this.grid,C,B,H,J.rowIndex,A)}if(true!==this.eventsSuspended&&false===this.fireEvent("beforeaction",this.grid,C,B,H,G,J.rowIndex,A)){return }else{if(true!==this.eventsSuspended){this.fireEvent("action",this.grid,C,B,H,G,J.rowIndex,A)}}}}});Ext.reg("cellactions",Ext.ux.grid.CellActions);Ext.ux.SliderTip=Ext.extend(Ext.Tip,{minWidth:10,offsets:[0,-10],init:function(A){A.on("dragstart",this.onSlide,this);A.on("drag",this.onSlide,this);A.on("dragend",this.hide,this);A.on("destroy",this.destroy,this)},onSlide:function(A){this.show();this.body.update(this.getText(A));this.doAutoWidth();this.el.alignTo(A.thumb,"b-t?",this.offsets)},getText:function(A){return A.getValue()}});Ext.ux.ColorField=function(A){Ext.ux.ColorField.superclass.constructor.call(this,A);this.on("render",this.handleRender)};Ext.extend(Ext.ux.ColorField,Ext.form.TriggerField,{initComponent:function(){this.addEvents({select:true})},showHexValue:false,triggerClass:"x-form-color-trigger",defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off",maxlength:"6"},lengthText:"Color hex values must be either 3 or 6 characters.",blankText:"Must have a hexidecimal value in the format ABCDEF.",defaultColor:"FFFFFF",maskRe:/[a-f0-9]/i,regex:/[a-f0-9]/i,curColor:"ffffff",validateValue:function(A){if(!this.showHexValue){return true}if(A.length<1){this.el.setStyle({"background-color":"#"+this.defaultColor});if(!this.allowBlank){this.markInvalid(String.format(this.blankText,A));return false}return true}if(A.length!=3&&A.length!=6){this.markInvalid(String.format(this.lengthText,A));return false}this.setColor(A);return true},validateBlur:function(){return !this.menu||!this.menu.isVisible()},markInvalid:function(A){Ext.ux.ColorField.superclass.markInvalid.call(this,A);this.el.setStyle({"background-image":"url(../theme/images/default/grid/invalid_line.gif)"})},getValue:function(){return this.curValue||this.defaultValue||"FFFFFF"},setValue:function(A){Ext.ux.ColorField.superclass.setValue.call(this,A);this.setColor(A)},setColor:function(A){this.curColor=A;this.el.setStyle({"background-color":"#"+A,"background-image":"none"});if(!this.showHexValue){this.el.setStyle({"text-indent":"-100px"});if(Ext.isIE){this.el.setStyle({"margin-left":"100px"})}}},handleRender:function(){this.setDefaultColor()},setDefaultColor:function(){this.setValue(this.defaultColor)},menuListeners:{select:function(A,B){this.setValue(B)},show:function(){this.onFocus()},hide:function(){this.focus();var A=this.menuListeners;this.menu.un("select",A.select,this);this.menu.un("show",A.show,this);this.menu.un("hide",A.hide,this)}},handleSelect:function(B,A){this.fireEvent("select",B,A);this.setValue(A)},onTriggerClick:function(){if(this.disabled){return }if(this.menu==null){this.menu=new Ext.menu.ColorMenu();this.menu.palette.on("select",this.handleSelect,this)}this.menu.on(Ext.apply({},this.menuListeners,{scope:this}));this.menu.show(this.el,"tl-bl?")}});Ext.reg("colorfield",Ext.ux.ColorField);Ax.ToolItem=Ext.extend(Ext.Component,{tool:"",imgclass:"",selected:false,onSelect:function(){},onUnselect:function(){},unselect:function(A){this.selected=false;this.el.dom.className="toolboxItem";if(A!=true){this.onUnselect(this)}},select:function(A){this.el.dom.className="toolboxItem";this.el.addClass("tbx_sel");this.selected=true;if(A!=true){this.onSelect(this)}},initComponents:function(){Ax.ToolItem.superclass.initComponent.apply(this,arguments)},handleMouseEvents:function(B,A){if(!this.el.hasClass("tbx_sel")){this.el.dom.className="toolboxItem";switch(B.type){case"mouseover":this.el.addClass("tbx_ovr");break;case"mouseout":this.el.addClass("tbx_idl");break;case"mousedown":this.onSelect(this);this.el.addClass("tbx_sel");this.selected=true;break}}else{}},onRender:function(A){if(!this.template){this.template=new Ext.Template('<div class="toolboxButton {imgclass}"></div>')}if(!this.el){this.el=A.createChild()}this.template.append(this.el,{tool:this.tool,imgclass:this.imgclass});this.el.dom.className="toolboxItem tbx_idl";this.el.on("mousedown",this.handleMouseEvents,this);this.el.on("mouseover",this.handleMouseEvents,this);this.el.on("mouseout",this.handleMouseEvents,this);if(this.qtip){Ext.QuickTips.register({target:this.el.dom.firstChild,title:"Draw Tools",text:this.qtip})}}});Ext.reg("tbxitem",Ax.ToolItem);Ax.toolConfig={select:["tx_select","Select Shapes","Select"],rect:["tx_rectangle","Draw Rectangle","Rectangle"],roundrect:["tx_roundrect","Draw Rounded Rectangle","Round Rectangle"],ellipse:["tx_circle","Draw Ellipse/Circle","Ellipse/Circle"],line:["tx_line","Draw Line","Line"],path:["tx_path","Draw freeform path","Freeform Path"],controlpath:["tx_polygon","Draw Polygon","Polygon"],text:["tx_text","Draw text","Text"],image:["tx_image","Draw Image/Picture","Image"],shape:["tx_shape","Add a Shape from library","Library"],reset:["tx_reset","Reset/Clear/Empty Frame","Reset"],"delete":["tx_delete","Delete selected shape","Delete"]};Ax.ToolsPanel=Ext.extend(Ext.Panel,{changeTool:function(A){Ax.setTool(A.tool)},initComponent:function(){var A=[];for(var B in Ax.toolConfig){A.push(new Ax.ToolItem({tool:B,id:"tool_"+B,toolConfig:Ax.toolConfig,qtip:Ax.toolConfig[B][1],imgclass:Ax.toolConfig[B][0],onSelect:this.changeTool}))}Ext.apply(this,{layout:"table",border:false,layoutConfig:{columns:2},items:A});Ax.ToolsPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("toolbox",Ax.ToolsPanel);Ax.defaultcolor={line:"000000",fill:"FF0000",width:1,grid:1};Ax.Color={update:function(){},line:Ax.defaultcolor.line,fill:Ax.defaultcolor.fill,width:Ax.defaultcolor.width,grid:Ax.defaultcolor.grid};Ax.setColors=function(A){if(A.gd){Ax.viewport.findById("fgd").setValue(A.gd)}if(A.lw){Ax.viewport.findById("flw").setValue(A.lw)}if(A.lc){Ax.viewport.findById("flc").setColor(A.lc)}if(A.fc){Ax.viewport.findById("ffc").setColor(A.fc)}};Ax.ColorPanel=Ext.extend(Ext.Panel,{initComponent:function(){this.LWTip=new Ext.ux.SliderTip({getText:function(A){return String.format("Line Width: {0}px",A.getValue())}});this.GDTip=new Ext.ux.SliderTip({getText:function(A){return String.format("Snapping Grid Size: {0}px",A.getValue()+1)}});Ext.apply(this,{border:false,items:[{xtype:"label",style:"font-size: xx-small; margin-left: 3px",text:"Line"},{xtype:"slider",id:"flw",maxValue:20,plugins:this.LWTip,value:Ax.Color.width,listeners:{drag:function(B,A){Ax.Color.width=B.getValue();Ax.Color.update("lw")}}},{xtype:"colorfield",id:"flc",width:48,defaultColor:Ax.Color.line,listeners:{select:function(A,B){Ax.Color.line=B;Ax.Color.update("lc")}}},{xtype:"label",style:"font-size: xx-small; margin-left: 3px",text:"Fill"},{xtype:"colorfield",id:"ffc",width:48,defaultColor:Ax.Color.fill,listeners:{select:function(A,B){Ax.Color.fill=B;Ax.Color.update("fc")}}},{xtype:"label",style:"font-size: xx-small; margin-left: 3px",text:"Grid"},{xtype:"slider",maxValue:30,id:"fgd",plugins:this.GDTip,value:Ax.Color.grid,listeners:{drag:function(B,A){Ax.Color.grid=B.getValue()+1;Ax.Color.update("gd")}}}]});Ax.ColorPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("drawpanel",Ax.ColorPanel);var Sylvester={version:"0.1.3",precision:0.000001};function Vector(){}Vector.prototype={e:function(A){return(A<1||A>this.elements.length)?null:this.elements[A-1]},dimensions:function(){return this.elements.length},modulus:function(){return Math.sqrt(this.dot(this))},eql:function(B){var C=this.elements.length;var A=B.elements||B;if(C!=A.length){return false}do{if(Math.abs(this.elements[C-1]-A[C-1])>Sylvester.precision){return false}}while(--C);return true},dup:function(){return Vector.create(this.elements)},map:function(A){var B=[];this.each(function(C,D){B.push(A(C,D))});return Vector.create(B)},each:function(C){var D=this.elements.length,A=D,B;do{B=A-D;C(this.elements[B],B+1)}while(--D)},toUnitVector:function(){var A=this.modulus();if(A===0){return this.dup()}return this.map(function(B){return B/A})},angleFrom:function(D){var E=D.elements||D;var C=this.elements.length,F=C,G;if(C!=E.length){return null}var A=0,I=0,H=0;this.each(function(J,K){A+=J*E[K-1];I+=J*J;H+=E[K-1]*E[K-1]});I=Math.sqrt(I);H=Math.sqrt(H);if(I*H===0){return null}var B=A/(I*H);if(B<-1){B=-1}if(B>1){B=1}return Math.acos(B)},isParallelTo:function(A){var B=this.angleFrom(A);return(B===null)?null:(B<=Sylvester.precision)},isAntiparallelTo:function(A){var B=this.angleFrom(A);return(B===null)?null:(Math.abs(B-Math.PI)<=Sylvester.precision)},isPerpendicularTo:function(A){var B=this.dot(A);return(B===null)?null:(Math.abs(B)<=Sylvester.precision)},add:function(B){var A=B.elements||B;if(this.elements.length!=A.length){return null}return this.map(function(C,D){return C+A[D-1]})},subtract:function(B){var A=B.elements||B;if(this.elements.length!=A.length){return null}return this.map(function(C,D){return C-A[D-1]})},multiply:function(A){return this.map(function(B){return B*A})},x:function(A){return this.multiply(A)},dot:function(B){var A=B.elements||B;var C,D=0,E=this.elements.length;if(E!=A.length){return null}do{D+=this.elements[E-1]*A[E-1]}while(--E);return D},cross:function(D){var E=D.elements||D;if(this.elements.length!=3||E.length!=3){return null}var C=this.elements;return Vector.create([(C[1]*E[2])-(C[2]*E[1]),(C[2]*E[0])-(C[0]*E[2]),(C[0]*E[1])-(C[1]*E[0])])},max:function(){var A=0,D=this.elements.length,B=D,C;do{C=B-D;if(Math.abs(this.elements[C])>Math.abs(A)){A=this.elements[C]}}while(--D);return A},indexOf:function(A){var C=null,E=this.elements.length,B=E,D;do{D=B-E;if(C===null&&this.elements[D]==A){C=D+1}}while(--E);return C},toDiagonalMatrix:function(){return Matrix.Diagonal(this.elements)},round:function(){return this.map(function(A){return Math.round(A)})},snapTo:function(A){return this.map(function(B){return(Math.abs(B-A)<=Sylvester.precision)?A:B})},distanceFrom:function(D){if(D.anchor){return D.distanceFrom(this)}var A=D.elements||D;if(A.length!=this.elements.length){return null}var C=0,B;this.each(function(E,F){B=E-A[F-1];C+=B*B});return Math.sqrt(C)},liesOn:function(A){return A.contains(this)},liesIn:function(A){return A.contains(this)},rotate:function(D,F){var B,E,A,I,H;switch(this.elements.length){case 2:B=F.elements||F;if(B.length!=2){return null}E=Matrix.Rotation(D).elements;A=this.elements[0]-B[0];I=this.elements[1]-B[1];return Vector.create([B[0]+E[0][0]*A+E[0][1]*I,B[1]+E[1][0]*A+E[1][1]*I]);break;case 3:if(!F.direction){return null}var G=F.pointClosestTo(this).elements;E=Matrix.Rotation(D,F.direction).elements;A=this.elements[0]-G[0];I=this.elements[1]-G[1];H=this.elements[2]-G[2];return Vector.create([G[0]+E[0][0]*A+E[0][1]*I+E[0][2]*H,G[1]+E[1][0]*A+E[1][1]*I+E[1][2]*H,G[2]+E[2][0]*A+E[2][1]*I+E[2][2]*H]);break;default:return null}},reflectionIn:function(D){if(D.anchor){var B=this.elements.slice();var E=D.pointClosestTo(B).elements;return Vector.create([E[0]+(E[0]-B[0]),E[1]+(E[1]-B[1]),E[2]+(E[2]-(B[2]||0))])}else{var A=D.elements||D;if(this.elements.length!=A.length){return null}return this.map(function(C,F){return A[F-1]+(A[F-1]-C)})}},to3D:function(){var A=this.dup();switch(A.elements.length){case 3:break;case 2:A.elements.push(0);break;default:return null}return A},inspect:function(){return"["+this.elements.join(", ")+"]"},setElements:function(A){this.elements=(A.elements||A).slice();return this}};Vector.create=function(B){var A=new Vector();return A.setElements(B)};Vector.i=Vector.create([1,0,0]);Vector.j=Vector.create([0,1,0]);Vector.k=Vector.create([0,0,1]);Vector.Random=function(B){var A=[];do{A.push(Math.random())}while(--B);return Vector.create(A)};Vector.Zero=function(B){var A=[];do{A.push(0)}while(--B);return Vector.create(A)};function Matrix(){}Matrix.prototype={e:function(B,A){if(B<1||B>this.elements.length||A<1||A>this.elements[0].length){return null}return this.elements[B-1][A-1]},row:function(A){if(A>this.elements.length){return null}return Vector.create(this.elements[A-1])},col:function(C){if(C>this.elements[0].length){return null}var B=[],E=this.elements.length,A=E,D;do{D=A-E;B.push(this.elements[D][C-1])}while(--E);return Vector.create(B)},dimensions:function(){return{rows:this.elements.length,cols:this.elements[0].length}},rows:function(){return this.elements.length},cols:function(){return this.elements[0].length},eql:function(A){var H=A.elements||A;if(typeof (H[0][0])=="undefined"){H=Matrix.create(H).elements}if(this.elements.length!=H.length||this.elements[0].length!=H[0].length){return false}var E=this.elements.length,G=E,D,C,F=this.elements[0].length,B;do{D=G-E;C=F;do{B=F-C;if(Math.abs(this.elements[D][B]-H[D][B])>Sylvester.precision){return false}}while(--C)}while(--E);return true},dup:function(){return Matrix.create(this.elements)},map:function(F){var E=[],D=this.elements.length,H=D,C,B,G=this.elements[0].length,A;do{C=H-D;B=G;E[C]=[];do{A=G-B;E[C][A]=F(this.elements[C][A],C+1,A+1)}while(--B)}while(--D);return Matrix.create(E)},isSameSizeAs:function(A){var B=A.elements||A;if(typeof (B[0][0])=="undefined"){B=Matrix.create(B).elements}return(this.elements.length==B.length&&this.elements[0].length==B[0].length)},add:function(A){var B=A.elements||A;if(typeof (B[0][0])=="undefined"){B=Matrix.create(B).elements}if(!this.isSameSizeAs(B)){return null}return this.map(function(C,E,D){return C+B[E-1][D-1]})},subtract:function(A){var B=A.elements||A;if(typeof (B[0][0])=="undefined"){B=Matrix.create(B).elements}if(!this.isSameSizeAs(B)){return null}return this.map(function(C,E,D){return C-B[E-1][D-1]})},canMultiplyFromLeft:function(A){var B=A.elements||A;if(typeof (B[0][0])=="undefined"){B=Matrix.create(B).elements}return(this.elements[0].length==B.length)},multiply:function(O){if(!O.elements){return this.map(function(M){return M*O})}var G=O.modulus?true:false;var K=O.elements||O;if(typeof (K[0][0])=="undefined"){K=Matrix.create(K).elements}if(!this.canMultiplyFromLeft(K)){return null}var D=this.elements.length,E=D,I,B,C=K[0].length,F;var N=this.elements[0].length,A=[],J,H,L;do{I=E-D;A[I]=[];B=C;do{F=C-B;J=0;H=N;do{L=N-H;J+=this.elements[I][L]*K[L][F]}while(--H);A[I][F]=J}while(--B)}while(--D);var K=Matrix.create(A);return G?K.col(1):K},x:function(A){return this.multiply(A)},minor:function(J,I,G,F){var A=[],C=G,E,B,D;var K=this.elements.length,H=this.elements[0].length;do{E=G-C;A[E]=[];B=F;do{D=F-B;A[E][D]=this.elements[(J+E-1)%K][(I+D-1)%H]}while(--B)}while(--C);return Matrix.create(A)},transpose:function(){var F=this.elements.length,G=this.elements[0].length;var E=[],D=G,C,B,A;do{C=G-D;E[C]=[];B=F;do{A=F-B;E[C][A]=this.elements[A][C]}while(--B)}while(--D);return Matrix.create(E)},isSquare:function(){return(this.elements.length==this.elements[0].length)},max:function(){var A=0,E=this.elements.length,G=E,D,C,F=this.elements[0].length,B;do{D=G-E;C=F;do{B=F-C;if(Math.abs(this.elements[D][B])>Math.abs(A)){A=this.elements[D][B]}}while(--C)}while(--E);return A},indexOf:function(A){var D=null,F=this.elements.length,H=F,E,C,G=this.elements[0].length,B;do{E=H-F;C=G;do{B=G-C;if(this.elements[E][B]==A){return{i:E+1,j:B+1}}}while(--C)}while(--F);return null},diagonal:function(){if(!this.isSquare){return null}var C=[],D=this.elements.length,A=D,B;do{B=A-D;C.push(this.elements[B][B])}while(--D);return Vector.create(C)},toRightTriangular:function(){var F=this.dup(),D;var B=this.elements.length,C=B,E,G,H=this.elements[0].length,A;do{E=C-B;if(F.elements[E][E]==0){for(j=E+1;j<C;j++){if(F.elements[j][E]!=0){D=[];G=H;do{A=H-G;D.push(F.elements[E][A]+F.elements[j][A])}while(--G);F.elements[E]=D;break}}}if(F.elements[E][E]!=0){for(j=E+1;j<C;j++){var I=F.elements[j][E]/F.elements[E][E];D=[];G=H;do{A=H-G;D.push(A<=E?0:F.elements[j][A]-F.elements[E][A]*I)}while(--G);F.elements[j]=D}}}while(--B);return F},toUpperTriangular:function(){return this.toRightTriangular()},determinant:function(){if(!this.isSquare()){return null}var E=this.toRightTriangular();var C=E.elements[0][0],D=E.elements.length-1,A=D,B;do{B=A-D+1;C=C*E.elements[B][B]}while(--D);return C},det:function(){return this.determinant()},isSingular:function(){return(this.isSquare()&&this.determinant()===0)},trace:function(){if(!this.isSquare()){return null}var C=this.elements[0][0],D=this.elements.length-1,A=D,B;do{B=A-D+1;C+=this.elements[B][B]}while(--D);return C},tr:function(){return this.trace()},rank:function(){var H=this.toRightTriangular(),G=0;var D=this.elements.length,F=D,C,B,E=this.elements[0].length,A;do{C=F-D;B=E;do{A=E-B;if(Math.abs(H.elements[C][A])>Sylvester.precision){G++;break}}while(--B)}while(--D);return G},rk:function(){return this.rank()},augment:function(J){var H=J.elements||J;if(typeof (H[0][0])=="undefined"){H=Matrix.create(H).elements}var E=this.dup(),I=E.elements[0].length;var C=E.elements.length,D=C,G,A,B=H[0].length,F;if(C!=H.length){return null}do{G=D-C;A=B;do{F=B-A;E.elements[G][I+F]=H[G][F]}while(--A)}while(--C);return E},inverse:function(){if(!this.isSquare()||this.isSingular()){return null}var C=this.elements.length,D=C,H,G;var I=this.augment(Matrix.I(C)).toRightTriangular();var J,K=I.elements[0].length,A,F,B;var L=[],E;do{H=C-1;F=[];J=K;L[H]=[];B=I.elements[H][H];do{A=K-J;E=I.elements[H][A]/B;F.push(E);if(A>=D){L[H].push(E)}}while(--J);I.elements[H]=F;for(G=0;G<H;G++){F=[];J=K;do{A=K-J;F.push(I.elements[G][A]-I.elements[H][A]*I.elements[G][H])}while(--J);I.elements[G]=F}}while(--C);return Matrix.create(L)},inv:function(){return this.inverse()},round:function(){return this.map(function(A){return Math.round(A)})},snapTo:function(A){return this.map(function(B){return(Math.abs(B-A)<=Sylvester.precision)?A:B})},inspect:function(){var C=[];var D=this.elements.length,A=D,B;do{B=A-D;C.push(Vector.create(this.elements[B]).inspect())}while(--D);return C.join("\n")},setElements:function(H){var J,A=H.elements||H;if(typeof (A[0][0])!="undefined"){var D=A.length,F=D,B,C,I;this.elements=[];do{J=F-D;B=A[J].length;C=B;this.elements[J]=[];do{I=C-B;this.elements[J][I]=A[J][I]}while(--B)}while(--D);return this}var E=A.length,G=E;this.elements=[];do{J=G-E;this.elements.push([A[J]])}while(--E);return this}};Matrix.create=function(A){var B=new Matrix();return B.setElements(A)};Matrix.I=function(F){var E=[],A=F,D,C,B;do{D=A-F;E[D]=[];C=A;do{B=A-C;E[D][B]=(D==B)?1:0}while(--C)}while(--F);return Matrix.create(E)};Matrix.Diagonal=function(C){var E=C.length,A=E,B;var D=Matrix.I(E);do{B=A-E;D.elements[B][B]=C[B]}while(--E);return D};Matrix.Rotation=function(A,G){if(!G){return Matrix.create([[Math.cos(A),-Math.sin(A)],[Math.sin(A),Math.cos(A)]])}var B=G.dup();if(B.elements.length!=3){return null}var F=B.modulus();var H=B.elements[0]/F,E=B.elements[1]/F,D=B.elements[2]/F;var J=Math.sin(A),C=Math.cos(A),I=1-C;return Matrix.create([[I*H*H+C,I*H*E-J*D,I*H*D+J*E],[I*H*E+J*D,I*E*E+C,I*E*D-J*H],[I*H*D-J*E,I*E*D+J*H,I*D*D+C]])};Matrix.RotationX=function(A){var C=Math.cos(A),B=Math.sin(A);return Matrix.create([[1,0,0],[0,C,-B],[0,B,C]])};Matrix.RotationY=function(A){var C=Math.cos(A),B=Math.sin(A);return Matrix.create([[C,0,B],[0,1,0],[-B,0,C]])};Matrix.RotationZ=function(A){var C=Math.cos(A),B=Math.sin(A);return Matrix.create([[C,-B,0],[B,C,0],[0,0,1]])};Matrix.Random=function(B,A){return Matrix.Zero(B,A).map(function(){return Math.random()})};Matrix.Zero=function(G,A){var F=[],E=G,D,C,B;do{D=G-E;F[D]=[];C=A;do{B=A-C;F[D][B]=0}while(--C)}while(--E);return Matrix.create(F)};function Line(){}Line.prototype={eql:function(A){return(this.isParallelTo(A)&&this.contains(A.anchor))},dup:function(){return Line.create(this.anchor,this.direction)},translate:function(B){var A=B.elements||B;return Line.create([this.anchor.elements[0]+A[0],this.anchor.elements[1]+A[1],this.anchor.elements[2]+(A[2]||0)],this.direction)},isParallelTo:function(B){if(B.normal){return B.isParallelTo(this)}var A=this.direction.angleFrom(B.direction);return(Math.abs(A)<=Sylvester.precision||Math.abs(A-Math.PI)<=Sylvester.precision)},distanceFrom:function(H){if(H.normal){return H.distanceFrom(this)}if(H.direction){if(this.isParallelTo(H)){return this.distanceFrom(H.anchor)}var L=this.direction.cross(H.direction).toUnitVector().elements;var F=this.anchor.elements,E=H.anchor.elements;return Math.abs((F[0]-E[0])*L[0]+(F[1]-E[1])*L[1]+(F[2]-E[2])*L[2])}else{var I=H.elements||H;var F=this.anchor.elements,C=this.direction.elements;var Q=I[0]-F[0],M=I[1]-F[1],J=(I[2]||0)-F[2];var O=Math.sqrt(Q*Q+M*M+J*J);if(O===0){return 0}var K=(Q*C[0]+M*C[1]+J*C[2])/O;var G=1-K*K;return Math.abs(O*Math.sqrt(G<0?0:G))}},contains:function(A){var B=this.distanceFrom(A);return(B!==null&&B<=Sylvester.precision)},liesIn:function(A){return A.contains(this)},intersects:function(A){if(A.normal){return A.intersects(this)}return(!this.isParallelTo(A)&&this.distanceFrom(A)<=Sylvester.precision)},intersectionWith:function(L){if(L.normal){return L.intersectionWith(this)}if(!this.intersects(L)){return null}var J=this.anchor.elements,B=this.direction.elements,I=L.anchor.elements,A=L.direction.elements;var V=B[0],U=B[1],T=B[2],H=A[0],G=A[1],E=A[2];var R=J[0]-I[0],O=J[1]-I[1],N=J[2]-I[2];var K=-V*R-U*O-T*N;var D=H*R+G*O+E*N;var F=V*V+U*U+T*T;var S=H*H+G*G+E*E;var C=V*H+U*G+T*E;var M=(K*S/F+C*D)/(S-C*C);return Vector.create([J[0]+M*V,J[1]+M*U,J[2]+M*T])},pointClosestTo:function(U){if(U.direction){if(this.intersects(U)){return this.intersectionWith(U)}if(this.isParallelTo(U)){return null}var X=this.direction.elements,W=U.direction.elements;var I=X[0],H=X[1],F=X[2],S=W[0],Q=W[1],M=W[2];var T=(F*S-I*M),R=(I*Q-H*S),O=(H*M-F*Q);var L=Vector.create([T*M-R*Q,R*S-O*M,O*Q-T*S]);var K=Plane.create(U.anchor,L);return K.intersectionWith(this)}else{var K=U.elements||U;if(this.contains(K)){return Vector.create(K)}var Y=this.anchor.elements,X=this.direction.elements;var I=X[0],H=X[1],F=X[2],G=Y[0],C=Y[1],B=Y[2];var T=I*(K[1]-C)-H*(K[0]-G),R=H*((K[2]||0)-B)-F*(K[1]-C),O=F*(K[0]-G)-I*((K[2]||0)-B);var J=Vector.create([H*T-F*O,F*R-I*T,I*O-H*R]);var Z=this.distanceFrom(K)/J.modulus();return Vector.create([K[0]+J.elements[0]*Z,K[1]+J.elements[1]*Z,(K[2]||0)+J.elements[2]*Z])}},rotate:function(Q,S){if(typeof (S.direction)=="undefined"){S=Line.create(S.to3D(),Vector.k)}var J=Matrix.Rotation(Q,S.direction).elements;var E=S.pointClosestTo(this.anchor).elements;var G=this.anchor.elements,B=this.direction.elements;var M=E[0],L=E[1],K=E[2],I=G[0],H=G[1],F=G[2];var P=I-M,O=H-L,N=F-K;return Line.create([M+J[0][0]*P+J[0][1]*O+J[0][2]*N,L+J[1][0]*P+J[1][1]*O+J[1][2]*N,K+J[2][0]*P+J[2][1]*O+J[2][2]*N],[J[0][0]*B[0]+J[0][1]*B[1]+J[0][2]*B[2],J[1][0]*B[0]+J[1][1]*B[1]+J[1][2]*B[2],J[2][0]*B[0]+J[2][1]*B[1]+J[2][2]*B[2]])},reflectionIn:function(O){if(O.normal){var H=this.anchor.elements,C=this.direction.elements;var L=H[0],J=H[1],G=H[2],I=C[0],F=C[1],E=C[2];var B=this.anchor.reflectionIn(O).elements;var N=L+I,M=J+F,K=G+E;var R=O.pointClosestTo([N,M,K]).elements;var T=[R[0]+(R[0]-N)-B[0],R[1]+(R[1]-M)-B[1],R[2]+(R[2]-K)-B[2]];return Line.create(B,T)}else{if(O.direction){return this.rotate(Math.PI,O)}else{var S=O.elements||O;return Line.create(this.anchor.reflectionIn([S[0],S[1],(S[2]||0)]),this.direction)}}},setVectors:function(A,C){A=Vector.create(A);C=Vector.create(C);if(A.elements.length==2){A.elements.push(0)}if(C.elements.length==2){C.elements.push(0)}if(A.elements.length>3||C.elements.length>3){return null}var B=C.modulus();if(B===0){return null}this.anchor=A;this.direction=Vector.create([C.elements[0]/B,C.elements[1]/B,C.elements[2]/B]);return this}};Line.create=function(B,C){var A=new Line();return A.setVectors(B,C)};Line.X=Line.create(Vector.Zero(3),Vector.i);Line.Y=Line.create(Vector.Zero(3),Vector.j);Line.Z=Line.create(Vector.Zero(3),Vector.k);function Plane(){}Plane.prototype={eql:function(A){return(this.contains(A.anchor)&&this.isParallelTo(A))},dup:function(){return Plane.create(this.anchor,this.normal)},translate:function(B){var A=B.elements||B;return Plane.create([this.anchor.elements[0]+A[0],this.anchor.elements[1]+A[1],this.anchor.elements[2]+(A[2]||0)],this.normal)},isParallelTo:function(B){var A;if(B.normal){A=this.normal.angleFrom(B.normal);return(Math.abs(A)<=Sylvester.precision||Math.abs(Math.PI-A)<=Sylvester.precision)}else{if(B.direction){return this.normal.isPerpendicularTo(B.direction)}}return null},isPerpendicularTo:function(A){var B=this.normal.angleFrom(A.normal);return(Math.abs(Math.PI/2-B)<=Sylvester.precision)},distanceFrom:function(E){if(this.intersects(E)||this.contains(E)){return 0}if(E.anchor){var C=this.anchor.elements,G=E.anchor.elements,F=this.normal.elements;return Math.abs((C[0]-G[0])*F[0]+(C[1]-G[1])*F[1]+(C[2]-G[2])*F[2])}else{var D=E.elements||E;var C=this.anchor.elements,F=this.normal.elements;return Math.abs((C[0]-D[0])*F[0]+(C[1]-D[1])*F[1]+(C[2]-(D[2]||0))*F[2])}},contains:function(E){if(E.normal){return null}if(E.direction){return(this.contains(E.anchor)&&this.contains(E.anchor.add(E.direction)))}else{var C=E.elements||E;var B=this.anchor.elements,F=this.normal.elements;var D=Math.abs(F[0]*(B[0]-C[0])+F[1]*(B[1]-C[1])+F[2]*(B[2]-(C[2]||0)));return(D<=Sylvester.precision)}},intersects:function(A){if(typeof (A.direction)=="undefined"&&typeof (A.normal)=="undefined"){return null}return !this.isParallelTo(A)},intersectionWith:function(L){if(!this.intersects(L)){return null}if(L.direction){var G=L.anchor.elements,C=L.direction.elements,M=this.anchor.elements,R=this.normal.elements;var V=(R[0]*(M[0]-G[0])+R[1]*(M[1]-G[1])+R[2]*(M[2]-G[2]))/(R[0]*C[0]+R[1]*C[1]+R[2]*C[2]);return Vector.create([G[0]+C[0]*V,G[1]+C[1]*V,G[2]+C[2]*V])}else{if(L.normal){var U=this.normal.cross(L.normal).toUnitVector();var R=this.normal.elements,G=this.anchor.elements,Q=L.normal.elements,F=L.anchor.elements;var W=Matrix.Zero(2,2),K=0;while(W.isSingular()){K++;W=Matrix.create([[R[K%3],R[(K+1)%3]],[Q[K%3],Q[(K+1)%3]]])}var I=W.inverse().elements;var T=R[0]*G[0]+R[1]*G[1]+R[2]*G[2];var S=Q[0]*F[0]+Q[1]*F[1]+Q[2]*F[2];var E=[I[0][0]*T+I[0][1]*S,I[1][0]*T+I[1][1]*S];var J=[];for(var H=1;H<=3;H++){J.push((K==H)?0:E[(H+(5-K)%3)%3])}return Line.create(J,U)}}},pointClosestTo:function(C){var E=C.elements||C;var B=this.anchor.elements,F=this.normal.elements;var D=(B[0]-E[0])*F[0]+(B[1]-E[1])*F[1]+(B[2]-(E[2]||0))*F[2];return Vector.create([E[0]+F[0]*D,E[1]+F[1]*D,(E[2]||0)+F[2]*D])},rotate:function(Q,S){var H=Matrix.Rotation(Q,S.direction).elements;var B=S.pointClosestTo(this.anchor).elements;var E=this.anchor.elements,L=this.normal.elements;var K=B[0],J=B[1],I=B[2],G=E[0],F=E[1],D=E[2];var P=G-K,O=F-J,M=D-I;return Plane.create([K+H[0][0]*P+H[0][1]*O+H[0][2]*M,J+H[1][0]*P+H[1][1]*O+H[1][2]*M,I+H[2][0]*P+H[2][1]*O+H[2][2]*M],[H[0][0]*L[0]+H[0][1]*L[1]+H[0][2]*L[2],H[1][0]*L[0]+H[1][1]*L[1]+H[1][2]*L[2],H[2][0]*L[0]+H[2][1]*L[1]+H[2][2]*L[2]])},reflectionIn:function(G){if(G.normal){var D=this.anchor.elements,K=this.normal.elements;var F=D[0],E=D[1],C=D[2],O=K[0],M=K[1],L=K[2];var B=this.anchor.reflectionIn(G).elements;var T=F+O,S=E+M,R=C+L;var I=G.pointClosestTo([T,S,R]).elements;var H=[I[0]+(I[0]-T)-B[0],I[1]+(I[1]-S)-B[1],I[2]+(I[2]-R)-B[2]];return Plane.create(B,H)}else{if(G.direction){return this.rotate(Math.PI,G)}else{var J=G.elements||G;return Plane.create(this.anchor.reflectionIn([J[0],J[1],(J[2]||0)]),this.normal)}}},setVectors:function(I,N,M){I=Vector.create(I);I=I.to3D();if(I===null){return null}N=Vector.create(N);N=N.to3D();if(N===null){return null}if(typeof (M)=="undefined"){M=null}else{M=Vector.create(M);M=M.to3D();if(M===null){return null}}var F=I.elements[0],E=I.elements[1],D=I.elements[2];var J=N.elements[0],H=N.elements[1],G=N.elements[2];var K,L;if(M!==null){var C=M.elements[0],B=M.elements[1],A=M.elements[2];K=Vector.create([(H-E)*(A-D)-(G-D)*(B-E),(G-D)*(C-F)-(J-F)*(A-D),(J-F)*(B-E)-(H-E)*(C-F)]);L=K.modulus();if(L===0){return null}K=Vector.create([K.elements[0]/L,K.elements[1]/L,K.elements[2]/L])}else{L=Math.sqrt(J*J+H*H+G*G);if(L===0){return null}K=Vector.create([N.elements[0]/L,N.elements[1]/L,N.elements[2]/L])}this.anchor=I;this.normal=K;return this}};Plane.create=function(A,D,C){var B=new Plane();return B.setVectors(A,D,C)};Plane.XY=Plane.create(Vector.Zero(3),Vector.k);Plane.YZ=Plane.create(Vector.Zero(3),Vector.i);Plane.ZX=Plane.create(Vector.Zero(3),Vector.j);Plane.YX=Plane.XY;Plane.ZY=Plane.YZ;Plane.XZ=Plane.ZX;var $V=Vector.create;var $M=Matrix.create;var $L=Line.create;var $P=Plane.create;var xpArray=new Array();var ypArray=new Array();var setPoints=new Array();var inout="";var typeTransform="";var contmove=0;var zoomx=0;var zoomy=0;var zoomscale=1;var zoommode="frame";var data_path_close=true;var data_text_family="";var data_text_size=19;var data_text_messaje="";var data_image_href="";var numClics=0;function RichDrawEditor(A,B){this.container=A;this.gridX=10;this.gridY=10;this.mouseDownX=0;this.mouseDownY=0;this.clicX=0;this.clicY=0;this.nowDraw=false;this.mode="";this.fillColor="";this.lineColor="";this.lineWidth="";this.selected=null;this.focusin=null;this.lineOpac=1;this.fillOpac=1;this.gridWidth=1;this.opac=1;this.text_messaje="";this.text_size=19;this.text_family="Arial";this.pathsEdit=false;this.previusBox=null;this.initialPath="";this.clipboard=null;this.moveNow=true;this.selectedBounds={x:0,y:0,width:0,height:0};this.onselect=function(){};this.onunselect=function(){};this.logtext="";this.renderer=B;this.renderer.init(this.container);this.renderer.editor=this;this.inputxy=[];this.onInputXY=function(){};Ext.get(this.container).on("mousedown",this.onMouseDown,this);Ext.get(this.container).on("mouseup",this.onMouseUp,this);Ext.get(this.container).on("mousemove",this.onTranslate,this);Ext.get(this.container).on("dblclick",this.onEndLine,this);Ext.get(this.container).on("selectstart",this.onSelectStart,this)}RichDrawEditor.prototype.log=function(A){if(document.forms[0].code){document.forms[0].code.value=A}};RichDrawEditor.prototype.getshapes=function(){return this.renderer.getshapes()};RichDrawEditor.prototype.info=function(A){return this.renderer.info(A)};RichDrawEditor.prototype.clearWorkspace=function(){this.container.innerHTML=""};RichDrawEditor.prototype.deleteSelection=function(){if(this.selected){this.renderer.remove(this.container.ownerDocument.getElementById("tracker"));this.renderer.remove(this.selected);this.selected=null}};RichDrawEditor.prototype.toFront=function(A){if(this.selected){this.renderer.index(this.selected,A)}};RichDrawEditor.prototype.deleteAll=function(){this.renderer.removeAll()};RichDrawEditor.prototype.select=function(A){if(A==this.selected){return }this.selected=A;this.renderer.showTracker(this.selected,this.pathsEdit);this.onselect(this)};RichDrawEditor.prototype.unselect=function(){if(this.selected){this.renderer.remove(this.container.ownerDocument.getElementById("tracker"));this.selected=null;this.onunselect(this)}};RichDrawEditor.prototype.getSelectedElement=function(){return this.selected};RichDrawEditor.prototype.toCurve=function(){this.renderer.tocurve()};RichDrawEditor.prototype.submitShape=function(A){if(this.mode!="select"){setMode("path","Path");this.actualStyle();this.selected=this.renderer.create(this.mode,this.fillColor,this.lineColor,this.fillOpac,this.lineOpac,this.lineWidth,this.mouseDownX,this.mouseDownY,1,1,this.textMessaje,this.textSize,this.textFamily,this.imageHref,A,"","");this.selected.id="shape:"+createUUID();Ext.get(this.selected).on("mousedown",this.onHit,this);setMode("select","Select")}else{this.renderer.transformShape(this.selected,A,null);this.renderer.remove(this.container.ownerDocument.getElementById("tracker"));this.renderer.showTracker(this.selected,this.pathsEdit)}};RichDrawEditor.prototype.setGrid=function(A,B){this.gridX=A;this.gridY=B;this.gridWidth=(B+A)/2};RichDrawEditor.prototype.actualStyle=function(){this.textMessaje=$("option_text_message").value;this.textSize=parseFloat($("option_text_size").value);this.textFamily=$("option_text_family").value;this.pathClose=$("option_path_close").checked;this.imageHref=$("option_image_href").value;return };RichDrawEditor.prototype.editCommand=function(B,A){if(B=="mode"){this.mode=A}else{if(this.selected==null){if(B=="fillcolor"){this.fillColor=A}else{if(B=="linecolor"){this.lineColor=A}else{if(B=="linewidth"){this.lineWidth=parseInt(A)+"px"}else{if(B=="fillopacity"){this.fillOpac=parseInt(A)}else{if(B=="lineopacity"){this.lineOpac=parseInt(A)}}}}}}else{this.renderer.editCommand(this.selected,B,A)}}};RichDrawEditor.prototype.queryCommand=function(A){if(A=="mode"){return this.mode}else{if(this.selected==null){if(A=="fillcolor"){return this.fillColor}else{if(A=="linecolor"){return this.lineColor}else{if(A=="linewidth"){return this.lineWidth}else{if(A=="fillopacity"){return this.fillOpac}else{if(A=="lineopacity"){return this.fillOpac}}}}}}else{return this.renderer.queryCommand(this.selected,A)}}};RichDrawEditor.prototype.onSelectStart=function(A){return false};RichDrawEditor.prototype.onKeyPress=function(C){var B;if(!C){var C=window.event}if(C.keyCode){B=C.keyCode}else{if(C.which){B=C.which}}var E=String.fromCharCode(B);if(C.ctrlKey&&E=="z"||C.ctrlKey&&E=="Z"){this.clipboard=this.renderer.undo()}if(this.mode=="select"){if(B==46){this.deleteSelection()}if(C.ctrlKey&&E=="x"||C.ctrlKey&&E=="X"){this.clipboard=this.renderer.copy(this.selected);this.deleteSelection()}if(C.ctrlKey&&E=="c"||C.ctrlKey&&E=="C"){this.clipboard=this.renderer.copy(this.selected)}if(C.ctrlKey&&E=="v"||C.ctrlKey&&E=="V"){this.selected=this.renderer.paste(this.clipboard,this.mouseDownX,this.mouseDownY);this.selected.id="shape:"+createUUID();Ext.get(this.selected).on("mousedown",this.onHit,this)}if(C.ctrlKey&&E=="d"||C.ctrlKey&&E=="D"){this.selected=this.renderer.duplicate(this.selected);this.selected.id="shape:"+createUUID();Ext.get(this.selected).on("mousedown",this.onHit,this)}if(C.ctrlKey&&B==37){if(this.pathsEdit==true){var F=parseFloat($("option_path_x").value)-1;var D=parseFloat($("option_path_y").value);this.renderer.nodeMove(F,D)}}if(B==38){if(this.pathsEdit==true){var F=parseFloat($("option_path_x").value);var D=parseFloat($("option_path_y").value)-1;this.renderer.nodeMove(F,D)}}if(B==39){if(this.pathsEdit==true){var F=parseFloat($("option_path_x").value)+1;var D=parseFloat($("option_path_y").value);this.renderer.nodeMove(F,D)}}if(B==40){if(this.pathsEdit==true){var F=parseFloat($("option_path_x").value);var D=parseFloat($("option_path_y").value)+1;this.renderer.nodeMove(F,D)}}}else{if(C.ctrlKey&&E=="x"){var A}}return false};RichDrawEditor.prototype.onMouseDown=function(A){if(A.button!=0){return }clockdata();if(this.mode!="select"){var I=0;if(this.mode=="zoom"){var G=Ext.get(this.container).getXY();var F=Math.round((A.getXY()[0]-G[0])/this.gridX)*this.gridX;var E=Math.round((A.getXY()[1]-G[1])/this.gridY)*this.gridY;var C=this.gridWidth;contmove=0;this.setGrid(C,C);this.unselect();xpArray=new Array();ypArray=new Array();this.mouseDownX=F;this.mouseDownY=E;xpArray.push(this.mouseDownX);ypArray.push(this.mouseDownY);this.renderer.zoom(this.mouseDownX,this.mouseDownY);I=1}if(this.mode=="controlpath"){this.actualStyle();if(numClics<=0){this.nowDraw=true;setPoints=new Array();var G=Ext.get(this.container).getXY();var F=Math.round((A.getXY()[0]-G[0])/this.gridX)*this.gridX;var E=Math.round((A.getXY()[1]-G[1])/this.gridY)*this.gridY;var C=this.gridWidth;contmove=0;this.setGrid(C,C);this.unselect();xpArray=new Array();ypArray=new Array();this.mouseDownX=F;this.mouseDownY=E;xpArray.push(this.mouseDownX);ypArray.push(this.mouseDownY);setPoints.push(this.mouseDownX+","+this.mouseDownY);this.actualStyle();this.selected=this.renderer.create(this.mode,this.fillColor,this.lineColor,this.fillOpac,this.lineOpac,this.lineWidth,this.mouseDownX,this.mouseDownY,1,1,this.textMessaje,this.textSize,this.textFamily,this.imageHref,"M0,0 1,1","","");this.selected.id="shape:"+createUUID();Ext.get(this.selected).on("mousedown",this.onHit,this);this.log(this.selected.id);Ext.get(this.selected).on("dblclick",this.onEndLine,this);Ext.get(this.container).on("mousemove",this.onDraw,this);numClics++}else{var H=this.inputxy;var D=parseFloat(H[0]);var B=parseFloat(H[1]);setPoints.push(D+","+B);this.renderer.clic(this.selected);numClics++}I=1}if(I==0){var G=Ext.get(this.container).getXY();var F=Math.round((A.getXY()[0]-G[0])/this.gridX)*this.gridX;var E=Math.round((A.getXY()[1]-G[1])/this.gridY)*this.gridY;var C=this.gridWidth;contmove=0;this.setGrid(C,C);this.unselect();xpArray=new Array();ypArray=new Array();this.mouseDownX=F;this.mouseDownY=E;xpArray.push(this.mouseDownX);ypArray.push(this.mouseDownY);this.unselect();this.actualStyle();this.selected=this.renderer.create(this.mode,this.fillColor,this.lineColor,this.fillOpac,this.lineOpac,this.lineWidth,this.mouseDownX,this.mouseDownY,1,1,this.textMessaje,this.textSize,this.textFamily,this.imageHref,"M0,0 1,1","","");this.selected.id="shape:"+createUUID();Ext.get(this.selected).on("mousedown",this.onHit,this);Ext.get(this.container).on("mousemove",this.onDraw,this)}}else{var G=Ext.get(this.container).getXY();var F=Math.round((A.getXY()[0]-G[0])/this.gridX)*this.gridX;var E=Math.round((A.getXY()[1]-G[1])/this.gridY)*this.gridY;if(this.mouseDownX!=F||this.mouseDownY!=E){if(this.selected!=null&&typeTransform=="Translate"){Ext.get(this.container).un("mousemove",this.onDrag);this.unselect()}}if(typeTransform=="Translate"){inout="move";this.renderer.remove(this.container.ownerDocument.getElementById("tracker"))}if(typeTransform=="Scale"||typeTransform=="Rotate"){inout="rotate_escale";Ext.get(this.container).on("mousemove",this.onDrag,this);Ext.get(this.selected).on("mousedown",this.onHit,this);this.renderer.remove(this.container.ownerDocument.getElementById("tracker"))}}return false};RichDrawEditor.prototype.onMouseUp=function(A){if(this.mode!="select"){if(this.mode=="controlpath"){}else{Ext.get(this.container).un("mousemove",this.onDraw);this.selected=null}}else{Ext.get(this.container).un("mousemove",this.onDraw);Ext.get(this.container).un("mousemove",this.onDrag);moveNow=false;contmove=0;if(typeTransform=="Rotate"||typeTransform=="Scale"){this.renderer.showTracker(this.selected,this.pathsEdit);typeTransform==""}if(typeTransform=="Translate"){this.renderer.showTracker(this.selected,this.pathsEdit);typeTransform=="";contmove=0}if(inout=="multiSelect"){}typeTransform==""}};RichDrawEditor.prototype.onDrag=function(E){moveNow=true;var G=Ext.get(this.container).getXY();var F=Math.round((E.getXY()[0]-G[0])/this.gridX)*this.gridX;var D=Math.round((E.getXY()[1]-G[1])/this.gridY)*this.gridY;var C=F-this.mouseDownX;var A=D-this.mouseDownY;var B=0;if(this.mode=="zoom"){B=1}if(this.mode=="controlpath"){B=1}if(B==0){if(inout=="multiSelect"){this.renderer.showMultiSelect(this.mouseDownX,this.mouseDownY)}if(typeTransform=="Translate"){Ext.get(this.container).getXY();this.log(this.mouseDownX+" "+E.getXY()[0]+" "+this.selectedBounds.x+"contmove"+contmove);this.renderer.move(this.selected,this.selectedBounds.x+C,this.selectedBounds.y+A,this.clicX,this.clicY)}if(typeTransform=="Rotate"){this.renderer.rotateShape(this.selected,this.previusBox,C,A)}if(typeTransform=="Scale"){this.renderer.scaleShape(this.selected,this.previusBox,this.selectedBounds.x+C,this.selectedBounds.y+A)}}};RichDrawEditor.prototype.onResize=function(D){var F=Ext.get(this.container).getXY();var E=Math.round((D.getXY()[0]-F[0])/this.gridX)*this.gridX;var C=Math.round((D.getXY()[1]-F[1])/this.gridY)*this.gridY;var B=E-this.mouseDownX;var A=C-this.mouseDownY;this.renderer.track(handle,B,A);show_tracker()};RichDrawEditor.prototype.onDraw=function(B){if(this.selected==null){return }else{var D=Ext.get(this.container).getXY();var C=Math.round((B.getXY()[0]-D[0])/this.gridX)*this.gridX;var A=Math.round((B.getXY()[1]-D[1])/this.gridY)*this.gridY;this.renderer.resize(this.selected,this.mouseDownX,this.mouseDownY,C,A)}};RichDrawEditor.prototype.onRotate=function(A){if(this.selected==null){}else{}};RichDrawEditor.prototype.onScale=function(A){if(this.selected==null){}else{}};RichDrawEditor.prototype.onTransform=function(A){if(this.selected==null){}else{}};RichDrawEditor.prototype.onTranslate=function(B){if(this.selected==null){}else{}var C=Ext.get(this.container).getXY();var A=Math.round(B.getXY()[0]-C[0]);var D=Math.round(B.getXY()[1]-C[1]);this.inputxy=[A,D];this.onInputXY(A,D)};RichDrawEditor.prototype.onHit=function(B){if(this.mode=="select"){if(B.stopPropagation){B.stopPropagation()}else{B.cancelBubble=true}if(B.preventDefault){B.preventDefault()}else{B.returnValue=false}if(inout=="multiSelect"){}else{Ext.get(this.container).un("mousemove",this.onDrag);typeTransform="Translate";contmove=0;var A=this.gridWidth;this.setGrid(A,A);this.select(B.getTarget());this.previusBox=this.selected;this.renderer.getProperties(this.selected);this.selectedBounds=this.renderer.bounds(this.selected);var C=Ext.get(this.container).getXY();this.mouseDownX=Math.round((B.getXY()[0]-C[0])/this.gridX)*this.gridX;this.mouseDownY=Math.round((B.getXY()[1]-C[1])/this.gridY)*this.gridY;this.log(this.gridX);this.renderer.info(this.selected);if(this.container.ownerDocument.getElementById("tracker")){this.renderer.remove(this.container.ownerDocument.getElementById("tracker"))}Ext.get(this.container).on("mousemove",this.onDrag,this)}}else{}};RichDrawEditor.prototype.onClic=function(A){if(this.mode=="controlpath"){}else{}};RichDrawEditor.prototype.onEndLine=function(A){if(this.mode=="controlpath"){numClics=0;this.selected=null}else{this.nowDraw=false}};function noselect(){}if(!Array.prototype.map){Array.prototype.map=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}var E=new Array(A);var D=arguments[1];for(var C=0;C<A;C++){if(C in this){E[C]=B.call(D,this[C],C,this)}}return E}}function createUUID(){var C=[];for(var A=0;A<5;A++){C.push("");for(var B=0;B<[4,2,2,2,6][A];B++){var D=parseInt((Math.random()*256)).toString(16);if(D.length==1){D="0"+D}C[A]+=D}}return C.join("-")}function AbstractRenderer(){}AbstractRenderer.prototype.init=function(A){};AbstractRenderer.prototype.bounds=function(A){return{x:0,y:0,width:0,height:0}};AbstractRenderer.prototype.create=function(H,B,J,G,F,K,C,M,L,A,E,I,D){};AbstractRenderer.prototype.datacreate=function(B,G,F,A,I,D,H,C,J,E){};AbstractRenderer.prototype.index=function(B,A){};AbstractRenderer.prototype.remove=function(A){};AbstractRenderer.prototype.copy=function(A){};AbstractRenderer.prototype.paste=function(B,A){};AbstractRenderer.prototype.duplicate=function(A){};AbstractRenderer.prototype.move=function(A,C,B){};AbstractRenderer.prototype.endmove=function(A){};AbstractRenderer.prototype.transform=function(A,C,B){};AbstractRenderer.prototype.scale=function(A,C,B){};AbstractRenderer.prototype.rotate=function(A,C,B){};AbstractRenderer.prototype.track=function(A){};AbstractRenderer.prototype.restruct=function(A){};AbstractRenderer.prototype.resize=function(A,E,C,D,B){};AbstractRenderer.prototype.editCommand=function(A,C,B){};AbstractRenderer.prototype.queryCommand=function(A,B){};AbstractRenderer.prototype.showTracker=function(A,B){};AbstractRenderer.prototype.getMarkup=function(){return null};AbstractRenderer.prototype.info=function(A){};AbstractRenderer.prototype.editShape=function(A,B){};AbstractRenderer.prototype.onKeyPress=function(){};AbstractRenderer.prototype.getshapes=function(){};function ang2v(E,G,C,F){var B=C-E;var A=F-G;var D=Math.atan2(A,B);return D}function dist2p(a,b,c,d){with(Math){return sqrt(abs((d-b)*(d-b)+(c-a)*(c-a)))}}function pmd2pb(B,A,G,F,E){pmdx=(1-E)*B+G*E;pmdy=(1-E)*A+F*E;var D=pmdx+","+pmdy;var C=new Array();C=[D,pmdx,pmdy];return C}function getAngle(B,A){var C=Math.atan2(A,B);return C}function ntrsccn2rb(L,K,J,I,G,E,C,B){var H=new Array();var F=0;var D=0;var M=(J-L)*(E-B)-(G-C)*(I-K);if(M==0){A=1;F=(1-A)*L+A*J;D=(1-A)*K+A*I;H=["",F,D];return H}var A=(((G-L)*(E-B))-((G-C)*(E-K)))/M;F=(1-A)*L+A*J;D=(1-A)*K+A*I;H=["",F,D];return H}function ccnmplct(G,F,E,C){var D=new Array();var I=E-G;var H=C-F;var B=I;var A=H;eia=H;eib=-I;eic=(F*I)-(H*G);D=[eia,eib,eic];return D}function GetString(D,E,A){var C=D.indexOf(E)+E.length;var B=D.indexOf(A,E);return D.substring(C,B)}function deg2rad(A){return(A/180)*Math.PI}function RichDrawViewer(A,B){this.container=A;this.renderer=B;this.renderer.init(this.container);this.renderer.editor=this}function SVGRenderer(){this.base=AbstractRenderer;this.svgRoot=null}SVGRenderer.prototype=new AbstractRenderer;SVGRenderer.prototype.init=function(A){this.container=A;this.container.style.MozUserSelect="none";var B="http://www.w3.org/2000/svg";this.svgRoot=this.container.ownerDocument.createElementNS(B,"svg");this.svgRoot.setAttributeNS(null,"viewBox",zoominit);this.svgRoot.setAttributeNS(null,"preserveAspectRatio","none");this.container.appendChild(this.svgRoot)};SVGRenderer.prototype.bounds=function(A){var C=new Object();var B=A.getBBox();C.x=B.x;C.y=B.y;C.width=B.width-18;C.height=B.height-18;return C};SVGRenderer.prototype.create=function(D,I,C,V,E,B,G,N,U,R,X,O,J,S,Z,M,L){var A="http://www.w3.org/2000/svg";var T="http://www.w3.org/1999/xlink";var Q;if(D=="rect"){Q=this.container.ownerDocument.createElementNS(A,"rect");Q.setAttributeNS(null,"x",G+"px");Q.setAttributeNS(null,"y",N+"px");Q.setAttributeNS(null,"width",U+"px");Q.setAttributeNS(null,"height",R+"px");Q.style.position="absolute"}else{if(D=="ellipse"||D=="circle"){Q=this.container.ownerDocument.createElementNS(A,"ellipse");Q.setAttributeNS(null,"cx",(G+U/2)+"px");Q.setAttributeNS(null,"cy",(N+R/2)+"px");if(D=="circle"){Q.setAttributeNS(null,"rx",(U/2)+"px");Q.setAttributeNS(null,"ry",(U/2)+"px")}else{Q.setAttributeNS(null,"rx",(U/2)+"px");Q.setAttributeNS(null,"ry",(R/2)+"px")}Q.style.position="absolute"}else{if(D=="roundrect"){Q=this.container.ownerDocument.createElementNS(A,"rect");Q.setAttributeNS(null,"x",G+"px");Q.setAttributeNS(null,"y",N+"px");Q.setAttributeNS(null,"rx","20px");Q.setAttributeNS(null,"ry","20px");Q.setAttributeNS(null,"width",U+"px");Q.setAttributeNS(null,"height",R+"px");Q.style.position="absolute"}else{if(D=="line"){Q=this.container.ownerDocument.createElementNS(A,"line");Q.setAttributeNS(null,"x1",G+"px");Q.setAttributeNS(null,"y1",N+"px");Q.setAttributeNS(null,"x2",G+U+"px");Q.setAttributeNS(null,"y2",N+R+"px");Q.style.position="absolute"}else{if(D=="polyline"){var K=xpArray;var P=ypArray;var F=""+xpArray[1]+","+ypArray[1];Q=this.container.ownerDocument.createElementNS(A,"polyline");Q.setAttributeNS(null,"points",Z);Q.style.position="absolute"}else{if(D=="path"){var Y=(Math.sqrt(2)-1)*4/3;var H="M 0,1 L 0.552,1 1,0.552  1,0  1,-0.552  0.552,-1 0,-1 -0.552,-1 -1,-0.552 -1,0  -1,0.552  -0.552,1  0,1z";Q=this.container.ownerDocument.createElementNS(A,"path");Q.setAttributeNS(null,"d",Z);Q.style.position="absolute"}else{if(D=="controlpath"){var W="M "+G+","+N+" L "+(G+1)+","+(N+1)+"z";Q=this.container.ownerDocument.createElementNS(A,"path");Q.setAttributeNS(null,"d",W);Q.setAttributeNS(null,"transform","translate(0,0)");Q.style.position="absolute"}else{if(D=="text"){var b=this.container.ownerDocument.createTextNode(X);Q=this.container.ownerDocument.createElementNS(A,"text");Q.setAttributeNS(null,"x",parseFloat(G)+"px");Q.setAttributeNS(null,"y",parseFloat(N)+"px");Q.setAttributeNS(null,"font-family",J);Q.setAttributeNS(null,"font-size",parseFloat(O));Q.style.position="absolute";Q.appendChild(b)}else{if(D=="clipPath"){Q=this.container.ownerDocument.createElementNS(A,"clipPath")}else{if(D=="linearGradient"){Q=this.container.ownerDocument.createElementNS(A,"linearGradient");Q.setAttributeNS(null,"x1",parseFloat(G));Q.setAttributeNS(null,"y1",parseFloat(N));Q.setAttributeNS(null,"x2",parseFloat(U));Q.setAttributeNS(null,"y2",parseFloat(R))}else{if(D=="stop"){Q=this.container.ownerDocument.createElementNS(A,"stop");Q.setAttributeNS(null,"stop-color",I);Q.setAttributeNS(null,"stop-opacity",parseFloat(V));Q.setAttributeNS(null,"offset",parseFloat(E))}else{if(D=="group"){Q=this.container.ownerDocument.createElementNS(A,"g");Q.setAttributeNS(null,"x",G+"px");Q.setAttributeNS(null,"y",N+"px");Q.setAttributeNS(null,"width",U+"px");Q.setAttributeNS(null,"height",R+"px");Q.setAttributeNS(null,"fill-opacity",parseFloat(V));Q.setAttributeNS(null,"fill",I)}else{if(D=="image"){var Q=this.container.ownerDocument.createElementNS(A,"image");Q.setAttributeNS(T,"href",S);Q.setAttributeNS(null,"x",G+"px");Q.setAttributeNS(null,"y",N+"px");Q.setAttributeNS(null,"width",U+"px");Q.setAttributeNS(null,"height",R+"px");Q.setAttributeNS(null,"opacity",parseFloat(V));Q.setAttributeNS(null,"preserveAspectRatio","none")}}}}}}}}}}}}}if(D=="zoom"){}else{if(M!=""){Q.setAttributeNS(null,"transform",M)}if(D!="image"||D!="group"||D!="stop"){if(C.length==0){C="none"}if(I.length==0){I="none"}Q.setAttributeNS(null,"fill",I);Q.setAttributeNS(null,"stroke",C);Q.setAttributeNS(null,"stroke-width",parseFloat(B));Q.setAttributeNS(null,"fill-opacity",parseFloat(V));Q.setAttributeNS(null,"stroke-opacity",parseFloat(E));Q.setAttributeNS(null,"stroke-linejoin","round")}if(L==""){this.svgRoot.appendChild(Q)}else{if(document.getElementById(L)){var a=document.getElementById(L);a.appendChild(Q)}}return Q}};SVGRenderer.prototype.create01=function(D,I,C,U,E,B,G,M,T,Q,W,N,J,R,L){var A="http://www.w3.org/2000/svg";var S="http://www.w3.org/1999/xlink";var P;if(D=="rect"){P=this.container.ownerDocument.createElementNS(A,"rect");P.setAttributeNS(null,"x",G+"px");P.setAttributeNS(null,"y",M+"px");P.setAttributeNS(null,"width",T+"px");P.setAttributeNS(null,"height",Q+"px");P.style.position="absolute"}else{if(D=="ellipse"){P=this.container.ownerDocument.createElementNS(A,"ellipse");P.setAttributeNS(null,"cx",(G+T/2)+"px");P.setAttributeNS(null,"cy",(M+Q/2)+"px");P.setAttributeNS(null,"rx",(T/2)+"px");P.setAttributeNS(null,"ry",(Q/2)+"px");P.style.position="absolute"}else{if(D=="roundrect"){P=this.container.ownerDocument.createElementNS(A,"rect");P.setAttributeNS(null,"x",G+"px");P.setAttributeNS(null,"y",M+"px");P.setAttributeNS(null,"rx","20px");P.setAttributeNS(null,"ry","20px");P.setAttributeNS(null,"width",T+"px");P.setAttributeNS(null,"height",Q+"px");P.style.position="absolute"}else{if(D=="line"){P=this.container.ownerDocument.createElementNS(A,"line");P.setAttributeNS(null,"x1",G+"px");P.setAttributeNS(null,"y1",M+"px");P.setAttributeNS(null,"x2",G+T+"px");P.setAttributeNS(null,"y2",M+Q+"px");P.style.position="absolute"}else{if(D=="polyline"){var K=xpArray;var O=ypArray;var F=""+xpArray[1]+","+ypArray[1];P=this.container.ownerDocument.createElementNS(A,"polyline");P.setAttributeNS(null,"points",F);P.style.position="absolute"}else{if(D=="path"){var X=(Math.sqrt(2)-1)*4/3;var H="M 0,1 L 0.552,1 1,0.552  1,0  1,-0.552  0.552,-1 0,-1 -0.552,-1 -1,-0.552 -1,0  -1,0.552  -0.552,1  0,1z";P=this.container.ownerDocument.createElementNS(A,"path");P.setAttributeNS(null,"d",H);P.setAttributeNS(null,"transform","translate(0,0)");P.style.position="absolute"}else{if(D=="controlpath"){var V="M "+G+","+M+" L "+(G+1)+","+(M+1)+"z";P=this.container.ownerDocument.createElementNS(A,"path");P.setAttributeNS(null,"d",V);P.setAttributeNS(null,"transform","translate(0,0)");P.style.position="absolute"}else{if(D=="text"){var Y=this.container.ownerDocument.createTextNode(W);P=this.container.ownerDocument.createElementNS(A,"text");P.setAttributeNS(null,"x",parseFloat(G)+"px");P.setAttributeNS(null,"y",parseFloat(M)+"px");P.setAttributeNS(null,"font-family",J);P.setAttributeNS(null,"font-size",parseFloat(N));P.style.position="absolute";P.appendChild(Y)}else{if(D=="clipPath"){P=this.container.ownerDocument.createElementNS(A,"clipPath")}else{if(D=="group"){P=this.container.ownerDocument.createElementNS(A,"g");P.setAttributeNS(null,"x",G+"px");P.setAttributeNS(null,"y",M+"px");P.setAttributeNS(null,"width",T+"px");P.setAttributeNS(null,"height",Q+"px")}else{if(D=="image"){var P=this.container.ownerDocument.createElementNS(A,"image");P.setAttributeNS(S,"href",R);P.setAttributeNS(null,"x",G+"px");P.setAttributeNS(null,"y",M+"px");P.setAttributeNS(null,"width",T+"px");P.setAttributeNS(null,"height",Q+"px");P.setAttributeNS(null,"opacity",parseFloat(U));P.setAttributeNS(null,"preserveAspectRatio","none")}}}}}}}}}}}if(D=="zoom"){}else{if(L!=""){P.setAttributeNS(null,"transform",L)}if(D!="image"){if(C.length==0){C="none"}if(I.length==0){I="none"}P.setAttributeNS(null,"fill",I);P.setAttributeNS(null,"stroke",C);P.setAttributeNS(null,"stroke-width",parseFloat(B));P.setAttributeNS(null,"fill-opacity",parseFloat(U));P.setAttributeNS(null,"stroke-opacity",parseFloat(E));P.setAttributeNS(null,"stroke-linejoin","round")}this.svgRoot.appendChild(P);return P}};SVGRenderer.prototype.zoom=function(K,J){if(zoommode=="frame"){var L=this.svgRoot.getAttributeNS(null,"viewBox");var L=zoominit;var D=L.split(" ");var R=parseFloat(D[0]);var Q=parseFloat(D[1]);var E=parseFloat(D[2]);var C=parseFloat(D[3])}else{var L=this.svgRoot.getAttributeNS(null,"viewBox");var D=L.split(" ");var A=parseFloat(D[0]);var T=parseFloat(D[1]);var H=parseFloat(D[2]);var F=parseFloat(D[3]);var P=H-A;var M=F-T}if(zoommode=="more"){var R=A;var Q=T;var E=H*0.95;var C=F*0.95}if(zoommode=="minus"){var R=A;var Q=T;var E=H*1.05;var C=F*1.05}var S=0;if(zoommode=="hand"){var L=zoominit;var D=L.split(" ");var O=parseFloat(D[2]);var N=parseFloat(D[3]);var I=centerZoomx;var G=centerZoomy;centerZoomx=K;centerZoomy=J;S=ang2v(I,G,centerZoomx,centerZoomy);var B=dist2p(I,G,centerZoomx,centerZoomy);var R=A+B*Math.cos(S+Math.PI);var Q=T+B*Math.sin(S+Math.PI);var E=H+B*Math.cos(S+Math.PI);var C=F+B*Math.sin(S+Math.PI)}S=S*180/Math.PI;this.svgRoot.setAttributeNS(null,"viewBox",(R)+" "+(Q)+" "+E+" "+C+"");var L=this.svgRoot.getAttributeNS(null,"viewBox")};SVGRenderer.prototype.datacreate=function(C,L,B,F,J,H,M,D,P,O,A,G,K,E){var N="http://www.w3.org/2000/svg";var I;I=this.container.ownerDocument.createElementNS(N,"path");I.setAttributeNS(null,"d",data);I.setAttributeNS(null,"transform","translate(0,0)");I.style.position="absolute";if(C.length==0){C="none"}I.setAttributeNS(null,"fill",C);if(L.length==0){L="none"}I.setAttributeNS(null,"stroke",L);I.setAttributeNS(null,"stroke-width",J);this.svgRoot.appendChild(I);return I};SVGRenderer.prototype.index=function(C,B){if(B==-1){this.svgRoot.appendChild(C)}if(B==0){this.svgRoot.insertBefore(C,C.parentNode.firstChild)}if(B==1||B==2){var G=C.getAttributeNS(null,"id");var F=this.svgRoot.childNodes.length;var D=0;for(var E=1;E<F;E++){var A=this.svgRoot.childNodes[E].getAttributeNS(null,"id");if(A==G){D=E}}if(B==1){if((D-1)>=-1){this.svgRoot.insertBefore(C,this.svgRoot.childNodes[D-1])}}if(B==2){if((D+1)<F){this.svgRoot.insertBefore(C,this.svgRoot.childNodes[D+2])}}}};SVGRenderer.prototype.remove=function(A){try{this.svgRoot.removeChild(A)}catch(B){}};SVGRenderer.prototype.removeAll=function(){while(this.svgRoot.hasChildNodes()){this.svgRoot.removeChild(this.svgRoot.firstChild)}};SVGRenderer.prototype.copy=function(B){var A;A=B.cloneNode(false);return A};SVGRenderer.prototype.paste=function(A,C,B){this.svgRoot.appendChild(A);return A};SVGRenderer.prototype.duplicate=function(B){var A;A=B.cloneNode(false);A.setAttributeNS(null,"fill","#aa00aa");this.svgRoot.appendChild(A);return A};SVGRenderer.prototype.undo=function(){this.svgRoot.removeChild(this.svgRoot.lastChild)};var xshe=0;var yshe=0;var isArc=false;var contArc=0;SVGRenderer.prototype.move=function(Q,A,C,V,T){var D=Q.getBBox();var P=0;var B=0;var H=false;if(Q.hasAttributeNS(null,"transform")){var a=Q.getAttributeNS(null,"transform");var O=GetString(a,"rotate(",",");var Y=GetString(a,",",")");Y+=")";var m=GetString(Y," ",", ");var f=GetString(Y,m+", ",")");m=parseFloat(m);f=parseFloat(f);P=parseFloat(O);var l=D.x+(D.width/2);var e=D.y+(D.height/2);Q.setAttributeNS(null,"transform","rotate("+(P)+", "+l+", "+e+")");var g=P*Math.PI/180;B=dist2p(m,f,A,C);H=true}contmove++;if(Q.tagName=="rect"){Q.setAttributeNS(null,"x",A);Q.setAttributeNS(null,"y",C)}if(Q.tagName=="g"){this.editor.log(Q.tagName+" ==============");Q.setAttributeNS(null,"x",A);Q.setAttributeNS(null,"y",C);Q.childNodes[0].setAttributeNS(null,"x",A+"px");Q.childNodes[0].setAttributeNS(null,"y",C+"px");Q.childNodes[1].setAttributeNS(null,"x",A+"px");Q.childNodes[1].setAttributeNS(null,"y",C+"px")}if(Q.tagName=="image"){Q.setAttributeNS(null,"x",A+"px");Q.setAttributeNS(null,"y",C+"px");var r=Q.getAttributeNS(null,"height");var n=Q.getAttributeNS(null,"width");this.editor.log(r+" "+n)}if(Q.tagName=="text"){var F=parseFloat(Q.getAttributeNS(null,"font-size"));Q.setAttributeNS(null,"x",A+"px");Q.setAttributeNS(null,"y",parseFloat(C+F)+"px")}if(Q.tagName=="line"){var L=Q.getBBox().width;var K=Q.getBBox().height;Q.setAttributeNS(null,"x1",A+"px");Q.setAttributeNS(null,"y1",C+"px");Q.setAttributeNS(null,"x2",A+L+"px");Q.setAttributeNS(null,"y2",C+K+"px")}if(Q.tagName=="ellipse"){var N=A+(Q.getBBox().width/2);var M=C+(Q.getBBox().height/2);Q.setAttributeNS(null,"cx",N+"px");Q.setAttributeNS(null,"cy",M+"px")}if(Q.tagName=="path"||Q.tagName=="polyline"){if(contmove==1){xshe=A;yshe=C}var p=Q.getAttributeNS(null,"d");p=p.replace(/, /g,",");p=p.replace(/ ,/g,",");var J=p.split(" ");var d="";var b=J[0].split(",");var W=parseFloat(b[0].substring(1));var U=parseFloat(b[1]);var o=ang2v(D.x,D.y,A,C);var P=Math.round((o/Math.PI*2)*360);var I=Math.cos(o);var G=Math.sin(o);var B=dist2p(A,C,D.x,D.y);var E=B*I;var Z=B*G;var k=/^[-]?\d*\.?\d*$/;for(var q=0;q<J.length;q++){if(J[q].indexOf(",")>0){var b=J[q].split(",");var c=b[0].substring(0,1);if(c=="A"||c=="a"){isArc=true;contArc=0}if(isArc==true){contArc++}if(contArc==4){contArc=0;isArc=false}if(!c.match(k)){var W=parseFloat(b[0].substring(1));var X=c}else{if(isArc==true&&contArc==2){var W=b[0]}else{var W=parseFloat(b[0])}var X=""}if(isArc==true&&contArc==2){b[1]=b[1].toString()}else{W+=E;b[1]=parseFloat(b[1]);b[1]+=Z}var S=W;var R=b[1];d+=X+S+","+R+" "}else{d+=J[q]+" "}}Q.setAttributeNS(null,"d",d)}};SVGRenderer.prototype.track=function(A){};SVGRenderer.prototype.clic=function(B){var A="";if(data_path_close==true){A="z"}var E=setPoints.length;var D="M"+setPoints[0]+" ";for(var F=1;F<E;F++){D+="L"+setPoints[F]+" "}var C=D+A;B.setAttributeNS(null,"d",C)};SVGRenderer.prototype.resize=function(G,K,H,L,I){var C=L-K;var B=I-H;if(G.tagName=="rect"){if(C<0){G.setAttributeNS(null,"x",L+"px");G.setAttributeNS(null,"width",-C+"px")}else{G.setAttributeNS(null,"width",C+"px")}if(B<0){G.setAttributeNS(null,"y",I+"px");G.setAttributeNS(null,"height",-B+"px")}else{G.setAttributeNS(null,"height",B+"px")}}if(G.tagName=="g"||G.tagName=="image"){if(C<0){G.setAttributeNS(null,"x",parseFloat(L)+"px");G.setAttributeNS(null,"width",parseFloat(-C)+"px")}else{G.setAttributeNS(null,"width",parseFloat(C)+"px")}if(B<0){G.setAttributeNS(null,"y",parseFloat(I)+"px");G.setAttributeNS(null,"height",parseFloat(-B)+"px")}else{G.setAttributeNS(null,"height",parseFloat(B)+"px")}}if(G.tagName=="ellipse"){if(C<0){G.setAttributeNS(null,"cx",(K+C/2)+"px");G.setAttributeNS(null,"rx",(-C/2)+"px")}else{G.setAttributeNS(null,"cx",(K+C/2)+"px");G.setAttributeNS(null,"rx",(C/2)+"px")}if(B<0){G.setAttributeNS(null,"cy",(H+B/2)+"px");G.setAttributeNS(null,"ry",(-B/2)+"px")}else{G.setAttributeNS(null,"cy",(H+B/2)+"px");G.setAttributeNS(null,"ry",(B/2)+"px")}}if(G.tagName=="line"){G.setAttributeNS(null,"x2",L);G.setAttributeNS(null,"y2",I)}if(G.tagName=="polyline"){xpArray.push(L);ypArray.push(I);var M=""+xpArray[1]+","+ypArray[1];var F="";var E="";var D=xpArray.length;for(var J=2;J<D;J++){F+=" "+xpArray[J]+" "+ypArray[J];E+=" "+xpArray[J]+", "+ypArray[J]}G.setAttributeNS(null,"points",M+F)}if(G.tagName=="path"){if(selectmode=="controlpath"){var A="";if(data_path_close==true){A="z"}var M="M"+setPoints[0]+" ";var D=setPoints.length;for(var J=1;J<D;J++){M+="L"+setPoints[J]+" "}var N=M+"L"+L+","+I+A;G.setAttributeNS(null,"d",N)}else{xpArray.push(L);ypArray.push(I);var M=""+xpArray[1]+","+ypArray[1];var F="";var E="";var D=xpArray.length;for(var J=2;J<D;J++){E+=" "+xpArray[J]+","+ypArray[J]}var A="";if(data_path_close==true){A="z"}G.setAttributeNS(null,"d","M "+M+" L"+E+A)}}if(G=="text"){}};SVGRenderer.prototype.tocurve=function(){var C=$("control_codebase").value.split("L");var B="";B+=C[0]+"C";var D=C.length-1;for(var A=1;A<D;A++){if(A%3==0){B+=C[A]+"C"}else{B+=C[A]}}if(D%3==0){B+=C[D]+""}if(D%3==2){B+=C[D-1]+"";B+=C[D]+""}if(D%3==1){B+=C[D-1]+"";B+=C[D-1]+"";B+=C[D]+""}if(D%3==3){B+=C[D-1]+"";B+=C[D-1]+"";B+=C[D-1]+"";B+=C[D]+""}setShape()};SVGRenderer.prototype.info=function(shape){var shInfo={};if(shape.id!="tracker"){shInfo.id=shape.getAttribute("id");shInfo.type=shape.tagName;if(shape.hasAttributeNS(null,"transform")){shInfo.transform=shape.getAttribute("transform")}else{shInfo.transform=""}if(shape.tagName=="text"){shInfo.textFamily=shape.getAttribute("font-family");shInfo.textSize=parseInt(shape.getAttribute("font-size"));shInfo.top=parseFloat(shape.getAttribute("y"));shInfo.left=parseFloat(shape.getAttribute("x"));shInfo.text=shape.textContent;shInfo.lineWidth=parseFloat(shape.getAttribute("stroke-width"))}if(shape.tagName!="image"||shape.tagName!="g"||shape.tagName!="stop"){shInfo.fillColor=shape.getAttribute("fill");shInfo.lineColor=shape.getAttribute("stroke");shInfo.fillOpac=parseFloat(shape.getAttribute("fill-opacity"));shInfo.lineOpac=parseFloat(shape.getAttribute("stroke-opacity"));shInfo.lineWidth=parseFloat(shape.getAttribute("stroke-width"));var mystyle=shape.getAttribute("style");if(mystyle!=null&&mystyle.indexOf("<![CDATA[")>=0){}else{if(mystyle!=null){var estilo=generateJSON(mystyle);var data=eval("("+estilo+")");(data["font-size"])?shInfo.textSize=data["font-size"]:shInfo.textSize;(data["font-family"])?shInfo.textFamily=data["font-family"]:shInfo.textFamily;(data.fill)?shInfo.fillColor=data.fill:shInfo.fillColor;(data.stroke)?shInfo.lineColor=data.stroke:shInfo.lineColor;(data.transform)?shInfo.transform=data.transform:shInfo.transform;(data["fill-opacity"])?shInfo.fillOpac=data["fill-opacity"]:shInfo.fillOpac}}}if(shape.tagName=="rect"){if(shape.getAttribute("rx")||shape.getAttribute("ry")){shInfo.type="roundrect";shInfo.rx=parseFloat(shape.getAttribute("rx"));shInfo.ry=parseFloat(shape.getAttribute("rx"))}shInfo.left=parseFloat(shape.getAttribute("x"));shInfo.top=parseFloat(shape.getAttribute("y"));shInfo.width=parseFloat(shape.getAttribute("width"));shInfo.height=parseFloat(shape.getAttribute("height"))}else{if(shape.tagName=="ellipse"||shape.tagName=="circle"){if(shape.tagName=="circle"){shInfo.width=parseFloat(shape.getAttribute("r"))*2;shInfo.height=parseFloat(shape.getAttribute("r"))*2}else{shInfo.width=parseFloat(shape.getAttribute("rx"))*2;shInfo.height=parseFloat(shape.getAttribute("ry"))*2}shInfo.left=parseFloat(shape.getAttribute("cx"))-(shInfo.width/2);shInfo.top=parseFloat(shape.getAttribute("cy"))-(shInfo.height/2)}else{if(shape.tagName=="linearGradient"){shInfo.left=(shape.getAttribute("x1"));shInfo.top=parseFloat(shape.getAttribute("y1"));shInfo.width=parseFloat(shape.getAttribute("x2"));shInfo.height=parseFloat(shape.getAttribute("y2"))}else{if(shape.tagName=="stop"){shInfo.fillColor=shape.getAttribute("stop-color");shInfo.fillOpac=shape.getAttribute("stop-opacity");shInfo.lineOpac=shape.getAttribute("offset");var mystyle=shape.getAttribute("style");if(mystyle!=null&&mystyle.indexOf("<![CDATA[")>=0){}else{if(mystyle!=null){var estilo=generateJSON(mystyle);var data=eval("("+estilo+")");(data["stop-color"])?shInfo.fillColor=data["stop-color"]:shInfo.fillColor;(data["stop-opacity"])?shInfo.fillOpac=data["stop-opacity"]:shInfo.fillOpac;document.getElementById("someinfo").value+=data["stop-color"]+" "}}}else{if(shape.tagName=="line"){shInfo.left=parseFloat(shape.getAttribute("x1"));shInfo.top=parseFloat(shape.getAttribute("y1"));shInfo.width=parseFloat(shape.getAttribute("x2"))-shInfo.left;shInfo.height=parseFloat(shape.getAttribute("y2"))-shInfo.top}else{if(shape.tagName=="polyline"){shInfo.points=shape.getAttribute("points")}else{if(shape.tagName=="g"){shInfo.type="group";shInfo.left=parseFloat(shape.getAttribute("x"));shInfo.top=parseFloat(shape.getAttribute("y"));shInfo.width=parseFloat(shape.getAttribute("width"));shInfo.height=parseFloat(shape.getAttribute("height"));shInfo.fillColor=shape.getAttribute("fill")}else{if(shape.tagName=="path"){shInfo.points=shape.getAttribute("d")}else{if(shape.tagName=="image"){shInfo.left=parseFloat(shape.getAttribute("x"));shInfo.top=parseFloat(shape.getAttribute("y"));shInfo.width=parseFloat(shape.getAttribute("width"));shInfo.height=parseFloat(shape.getAttribute("height"));shInfo.fillOpac=parseFloat(shape.getAttribute("opacity"));shInfo.href=shape.getAttribute("href")}}}}}}}}}if(shape.parentNode.tagName!="svg"){shInfo.parent=shape.parentNode.getAttribute("id")}return shInfo}else{}};SVGRenderer.prototype.info01=function(A){var B={};if(A.id!="tracker"){B.id=A.id.substr(6);B.type=A.tagName;if(A.hasAttributeNS(null,"transform")){B.transform=A.getAttribute("transform")}else{B.transform=""}if(A.tagName!="image"){B.fillColor=A.getAttribute("fill");B.lineColor=A.getAttribute("stroke");B.fillOpac=parseFloat(A.getAttribute("fill-opacity"));B.lineOpac=parseFloat(A.getAttribute("stroke-opacity"));B.lineWidth=parseFloat(A.getAttribute("stroke-width"))}if(A.tagName=="rect"){if(A.getAttribute("rx")||A.getAttribute("ry")){B.type="roundrect";B.rx=parseFloat(A.getAttribute("rx"));B.ry=parseFloat(A.getAttribute("rx"))}B.left=parseFloat(A.getAttribute("x"));B.top=parseFloat(A.getAttribute("y"));B.width=parseFloat(A.getAttribute("width"));B.height=parseFloat(A.getAttribute("height"))}else{if(A.tagName=="ellipse"){B.width=parseFloat(A.getAttribute("rx"))*2;B.height=parseFloat(A.getAttribute("ry"))*2;B.left=parseFloat(A.getAttribute("cx"))-(B.width/2);B.top=parseFloat(A.getAttribute("cy"))-(B.height/2)}else{if(A.tagName=="line"){B.left=parseFloat(A.getAttribute("x1"));B.top=parseFloat(A.getAttribute("y1"));B.width=parseFloat(A.getAttribute("x2"))-B.left;B.height=parseFloat(A.getAttribute("y2"))-B.top}else{if(A.tagName=="polyline"){B.points=A.getAttribute("points")}else{if(A.tagName=="path"){B.d=A.getAttribute("d")}else{if(A.tagName=="text"){B.textFamily=A.getAttribute("font-family");B.textSize=parseInt(A.getAttribute("font-size"));B.top=parseFloat(A.getAttribute("y"));B.left=parseFloat(A.getAttribute("x"));B.text=A.textContent;B.lineWidth=parseFloat(A.getAttribute("stroke-width"))}else{if(A.tagName=="image"){B.left=parseFloat(A.getAttribute("x"));B.top=parseFloat(A.getAttribute("y"));B.width=parseFloat(A.getAttribute("width"));B.height=parseFloat(A.getAttribute("height"));B.fillOpac=parseFloat(A.getAttribute("opacity"));B.href=A.getAttribute("href")}}}}}}}return B}else{}};SVGRenderer.prototype.transformShape=function(F,C,B){var G="http://www.w3.org/2000/svg";var A="http://www.w3.org/1999/xlink";if(F.tagName=="rect"){var E=F.getBBox();var D=C.split(";");F.setAttributeNS(null,"x",parseFloat(D[0]));F.setAttributeNS(null,"y",parseFloat(D[1]));F.setAttributeNS(null,"width",parseFloat(D[2]));F.setAttributeNS(null,"height",parseFloat(D[3]));var I=parseFloat(D[0])+parseFloat(E.width/2);var H=parseFloat(D[1])+parseFloat(E.height/2);F.setAttributeNS(null,"transform","rotate("+parseFloat(D[4])+","+I+","+H+")")}else{if(F.tagName=="text"){if(C.indexOf("<;>",0)==-1){F.textContent=C}else{var D=C.split("<;>");F.textContent=D[0];F.setAttributeNS(null,"font-size",parseFloat(D[1]));F.setAttributeNS(null,"font-family",D[2])}}else{if(F.tagName=="polyline"){F.setAttributeNS(null,"points",C)}else{if(F.tagName=="image"){if(C.indexOf(";",0)==-1){F.setAttributeNS(A,"href",C)}else{var E=F.getBBox();var D=C.split(";");F.setAttributeNS(null,"x",parseFloat(D[0]));F.setAttributeNS(null,"y",parseFloat(D[1]));F.setAttributeNS(null,"width",parseFloat(D[2]));F.setAttributeNS(null,"height",parseFloat(D[3]));var I=parseFloat(D[0])+parseFloat(E.width/2);var H=parseFloat(D[1])+parseFloat(E.height/2);F.setAttributeNS(null,"transform"," rotate("+parseFloat(D[4])+","+I+","+H+")")}}else{if(F.tagName=="path"){if(C.indexOf(";",0)==-1){F.setAttributeNS(null,"d",C);F.setAttributeNS(null,"transform",B)}else{var E=F.getBBox();var D=C.split(";");var I=parseFloat(D[0])+parseFloat(E.width/2);var H=parseFloat(D[1])+parseFloat(E.height/2);F.setAttributeNS(null,"transform","scale("+parseFloat(D[2])+","+parseFloat(D[3])+") rotate("+parseFloat(D[4])+","+I+","+H+") translate("+parseFloat(D[0])+","+parseFloat(D[1])+")")}}}}}}};SVGRenderer.prototype.editShape=function(A,B){if(A.tagName=="text"){A.textContent=B}else{if(A.tagName=="polyline"){A.setAttributeNS(null,"points",B)}else{if(A.tagName=="path"){A.setAttributeNS(null,"d",B)}}}};SVGRenderer.prototype.editCommand=function(A,C,B){if(A!=null){if(C=="fillcolor"){if(B!=""){A.setAttributeNS(null,"fill",B)}else{A.setAttributeNS(null,"fill","none")}}else{if(C=="linecolor"){if(B!=""){A.setAttributeNS(null,"stroke",B)}else{A.setAttributeNS(null,"stroke","none")}}else{if(C=="linewidth"){A.setAttributeNS(null,"stroke-width",parseInt(B)+"px")}else{if(C=="fillopacity"){if(A.tagName=="image"){A.setAttributeNS(null,"opacity",parseFloat(B))}else{A.setAttributeNS(null,"fill-opacity",parseFloat(B))}}else{if(C=="lineopacity"){A.setAttributeNS(null,"stroke-opacity",parseFloat(B))}}}}}}};SVGRenderer.prototype.queryCommand=function(B,C){var A="";if(B!=null){if(C=="fillcolor"){A=B.getAttributeNS(null,"fill");if(A=="none"){A=""}}else{if(C=="linecolor"){A=B.getAttributeNS(null,"stroke");if(A=="none"){A=""}}else{if(C=="linewidth"){A=B.getAttributeNS(null,"stroke");if(A=="none"){A=""}else{A=B.getAttributeNS(null,"stroke-width")}}else{if(C=="fillopacity"){if(B.tagName=="image"){B.setAttributeNS(null,"opacity",parseFloat(value))}else{B.setAttributeNS(null,"fill-opacity",parseFloat(value))}}else{if(C=="lineopacity"){B.setAttributeNS(null,"stroke-opacity",parseFloat(value))}}}}}}return A};SVGRenderer.prototype.getProperties=function(A){};SVGRenderer.prototype.showMultiSelect=function(B,A){var C=document.getElementById("trackerMultiSelect");if(C){this.remove(C)}var D=this.editor.inputxy;toX=parseFloat(D[0]);toY=parseFloat(D[1]);C=document.createElementNS(svgNamespace,"rect");C.setAttributeNS(null,"x",B);C.setAttributeNS(null,"y",A);C.setAttributeNS(null,"width",toX);C.setAttributeNS(null,"height",toY);C.setAttributeNS(null,"fill","#ffffff");C.setAttributeNS(null,"stroke","green");C.setAttributeNS(null,"stroke-width","1");this.svgRoot.appendChild(C)};function mouseCoord(){var A=this.editor.inputxy;A[0]=parseFloat(A[0]);A[1]=parseFloat(A[1]);return A}var memoNode=null;var memoPrevControl=new Array();var memoNextControl=new Array();SVGRenderer.prototype.nodeMove=function(G,F){var J=$("control_codebase").value;var I=$("option_path_x").value;var H=$("option_path_y").value;var C=I+","+H;$("option_path_x").value=G;$("option_path_y").value=F;var B=G;var A=F;var E=B+","+A;var D=new RegExp(C,"g");var K=J.replace(D,E);setShape()};function drawNodeControl(D,G){var H="http://www.w3.org/2000/svg";var B="#0066ff";var C=memoPrevControl[G].split(",");var F=document.createElementNS(H,"rect");F.setAttributeNS(null,"x",C[0]-2);F.setAttributeNS(null,"y",C[1]-2);F.setAttributeNS(null,"width",4);F.setAttributeNS(null,"height",4);F.setAttributeNS(null,"fill",B);F.setAttributeNS(null,"stroke","#000000");F.setAttributeNS(null,"stroke-width","0");F.setAttributeNS(null,"id","controlNode1");F.addEventListener("mousedown",function(I){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);D.appendChild(F);var A=memoNextControl[G].split(",");var E=document.createElementNS(H,"rect");E.setAttributeNS(null,"x",A[0]-2);E.setAttributeNS(null,"y",A[1]-2);E.setAttributeNS(null,"width",4);E.setAttributeNS(null,"height",4);E.setAttributeNS(null,"fill",B);E.setAttributeNS(null,"stroke","#000000");E.setAttributeNS(null,"stroke-width","0");E.setAttributeNS(null,"id","controlNode1");E.addEventListener("mousedown",function(I){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);D.appendChild(E)}SVGRenderer.prototype.showNodesCurve=function(J,S){memoNextControl=new Array();memoPrevControl=new Array();var A="http://www.w3.org/2000/svg";var I=this.container.ownerDocument.createElementNS(A,"g");I.setAttributeNS(null,"id","editNodesPath");var P=J.split(" ");var K="";var C=" ";prevControl=" ";nextControl=" ";nodePoint=" ";var O=P[0].split("M");var G=O[1].split(" ");var M=G[0].split(",");var H=document.createElementNS(A,"rect");H.setAttributeNS(null,"x",M[0]-2);H.setAttributeNS(null,"y",M[1]-2);H.setAttributeNS(null,"width",4);H.setAttributeNS(null,"height",4);H.setAttributeNS(null,"fill","#ff7700");H.setAttributeNS(null,"stroke","#000000");H.setAttributeNS(null,"stroke-width","0");H.setAttributeNS(null,"id","0");H.addEventListener("mousedown",function(U){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);I.appendChild(H);if(S==0){var N="#ffff00"}if(S==1){var N="#00ffff"}if(S==2){var N="#00cc00"}var Q="#ffff00";var D=P.length-1;var B="";var L=/^[-]?\d*\.?\d*$/;for(var T=1;T<=D;T++){var F=P[T].substring(0,1);if(!F.match(L)){var E=P[T].substring(1);N="#0000ff";if(F=="L"||F=="M"){N="#ffff00"}if(F=="C"){recall=T+2}}else{var E=P[T];var F="";N="#ff00ff";if(T==B){N="#ffff00"}}var M=E.split(",");if(memoNode!=null){}var H=document.createElementNS(A,"rect");H.setAttributeNS(null,"x",M[0]-2);H.setAttributeNS(null,"y",M[1]-2);H.setAttributeNS(null,"width",4);H.setAttributeNS(null,"height",4);H.setAttributeNS(null,"fill",N);H.setAttributeNS(null,"stroke","#000000");H.setAttributeNS(null,"stroke-width","0");H.setAttributeNS(null,"id",""+T);H.addEventListener("mousedown",function(U){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}drawNodeControl(I,this.getAttributeNS(null,"id"));memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);I.appendChild(H)}var R="";if(S==0){R="prev Control"}if(S==1){R="next Control"}if(S==2){R="points node"}return I};SVGRenderer.prototype.showNodesCurve1=function(P,L){memoNextControl=new Array();memoPrevControl=new Array();var J="http://www.w3.org/2000/svg";var F=this.container.ownerDocument.createElementNS(J,"g");F.setAttributeNS(null,"id","editNodesPath");var M=P.split("C");var B="";var G=" ";prevControl=" ";nextControl=" ";nodePoint=" ";var O=M[0].split("M");var A=O[1].split(" ");var K=A[0].split(",");var I=document.createElementNS(J,"rect");I.setAttributeNS(null,"x",K[0]-2);I.setAttributeNS(null,"y",K[1]-2);I.setAttributeNS(null,"width",4);I.setAttributeNS(null,"height",4);I.setAttributeNS(null,"fill","#ff7700");I.setAttributeNS(null,"stroke","#000000");I.setAttributeNS(null,"stroke-width","0");I.setAttributeNS(null,"id","0");I.addEventListener("mousedown",function(Q){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);F.appendChild(I);if(L==0){var D="#ffff00"}if(L==1){var D="#00ffff"}if(L==2){var D="#00cc00"}var N="#ffff00";var E=M.length-1;for(var H=1;H<=E;H++){G=M[H].split(" ");prevControl=G[0]+" ";nextControl=G[1]+" ";nodePoint=G[2]+" ";memoPrevControl[H]=prevControl;memoNextControl[H]=nextControl;if(L==0){B+=prevControl;var K=prevControl.split(",")}if(L==1){B+=nextControl;var K=nextControl.split(",")}if(L==2){B+=nodePoint;var K=nodePoint.split(",")}if(L==3){B+=nodePoint;var K=nodePoint.split(",")}if(memoNode!=null){}var I=document.createElementNS(J,"rect");I.setAttributeNS(null,"x",K[0]-2);I.setAttributeNS(null,"y",K[1]-2);I.setAttributeNS(null,"width",4);I.setAttributeNS(null,"height",4);I.setAttributeNS(null,"fill",D);I.setAttributeNS(null,"stroke","#000000");I.setAttributeNS(null,"stroke-width","0");I.setAttributeNS(null,"id",""+H);I.addEventListener("mousedown",function(Q){if(memoNode!=null){memoNode.setAttributeNS(null,"stroke-width",0)}drawNodeControl(F,this.getAttributeNS(null,"id"));memoNode=this;this.setAttributeNS(null,"fill-color","#ffff00");this.setAttributeNS(null,"stroke-width",1);$("option_path_num").value=this.getAttributeNS(null,"id");$("option_path_x").value=parseFloat(this.getAttributeNS(null,"x"))+2;$("option_path_y").value=parseFloat(this.getAttributeNS(null,"y"))+2},false);F.appendChild(I)}var C="";if(L==0){C="prev Control"}if(L==1){C="next Control"}if(L==2){C="points node"}return F};SVGRenderer.prototype.showTracker=function(B,f){var L=B.getBBox();var b=B.getScreenCTM();var S=B.getAttributeNS(null,"transform");var H=1;var D=B.getCTM();if(B.tagName=="rect"){}if(B.tagName=="image"){}if(B.tagName=="text"){}if(B.tagName=="line"){}if(B.tagName=="ellipse"){}var F=document.getElementById("tracker");if(F){this.remove(F)}var A="http://www.w3.org/2000/svg";F=document.createElementNS(A,"g");F.setAttributeNS(null,"id","tracker");var W=null;if(B.tagName=="path"){H=2;var V=B.getAttributeNS(null,"d");W=this.showNodesCurve(V,2)}var U=this.container.ownerDocument.createElementNS(A,"g");U.setAttributeNS(null,"id","transformSquares");var a=document.createElementNS(A,"path");var S="translate (0,0) rotate(0) translate(0,0) ";var M=S.split(") ");if(B.getAttributeNS(null,"transform")){var S=B.getAttributeNS(null,"transform");var M=S.split(") ")}var X=[];var Z=createPoint(L.x,L.y,L.width,L.height);X.push(createPoint(L.x+L.width,L.y,L.width,L.height));Z.x=L.x+L.width;Z.y=L.y;X.push(createPoint(L.x+L.width,L.y+L.height,L.width,L.height));Z.x=L.x+L.width;Z.y=L.y+L.height;X.push(createPoint(L.x,L.y+L.height,L.width,L.height));Z.x=L.x;Z.y=L.y+L.height;X.push(createPoint(L.x+L.width,L.y,L.width,L.height));var e=createPoint(X[0].x,X[0].y);var Y=createPoint(X[0].x,X[0].y);for(var d=1;d<X.length;d++){var K=X[d].x;var J=X[d].y;if(K<Y.x){Y.x=K}else{if(K>e.x){e.x=K}}if(J<Y.y){Y.y=J}else{if(J>e.y){e.y=J}}}a.setAttributeNS(null,"d","M"+(Y.x-10)+","+(Y.y-10)+" h"+(L.width+20)+","+(0)+" v"+(0)+","+(L.height+20)+" h"+(-L.width-20)+","+(0)+" z M"+(L.x+L.width+10)+","+(L.y+(L.height/2)+" h"+(25)+",0 "));a.setAttributeNS(null,"fill","none");a.setAttributeNS(null,"stroke","#cccccc");a.setAttributeNS(null,"stroke-width","1");var C=document.createElementNS(A,"ellipse");C.setAttributeNS(null,"cx",(L.x+L.width+40)+"px");C.setAttributeNS(null,"cy",(L.y+L.height/2)+"px");C.setAttributeNS(null,"rx",(5)+"px");C.setAttributeNS(null,"ry",(5)+"px");C.setAttributeNS(null,"fill","#ffffff");C.setAttributeNS(null,"stroke","green");C.setAttributeNS(null,"stroke-width","1");var c=document.createElementNS(A,"ellipse");c.setAttributeNS(null,"cx",(L.x+(L.width/2))+"px");c.setAttributeNS(null,"cy",(L.y+(L.height/2))+"px");c.setAttributeNS(null,"rx",(10)+"px");c.setAttributeNS(null,"ry",(10)+"px");c.setAttributeNS(null,"fill","#ffffff");c.setAttributeNS(null,"stroke","green");c.setAttributeNS(null,"stroke-width","1");var R=document.createElementNS(A,"rect");R.setAttributeNS(null,"width",10);R.setAttributeNS(null,"height",10);R.setAttributeNS(null,"fill","#ffffff");R.setAttributeNS(null,"stroke","green");R.setAttributeNS(null,"stroke-width","1");var P=document.createElementNS(A,"rect");P.setAttributeNS(null,"width",10);P.setAttributeNS(null,"height",10);P.setAttributeNS(null,"fill","#ffffff");P.setAttributeNS(null,"stroke","green");P.setAttributeNS(null,"stroke-width","1");var O=document.createElementNS(A,"rect");O.setAttributeNS(null,"width",10);O.setAttributeNS(null,"height",10);O.setAttributeNS(null,"fill","#ffffff");O.setAttributeNS(null,"stroke","green");O.setAttributeNS(null,"stroke-width","1");var N=document.createElementNS(A,"rect");N.setAttributeNS(null,"width",10);N.setAttributeNS(null,"height",10);N.setAttributeNS(null,"fill","#ffffff");N.setAttributeNS(null,"stroke","green");N.setAttributeNS(null,"stroke-width","1");var g=document.createElementNS(A,"rect");g.setAttributeNS(null,"width",10);g.setAttributeNS(null,"height",10);g.setAttributeNS(null,"fill","#ffffff");g.setAttributeNS(null,"stroke","green");g.setAttributeNS(null,"stroke-width","1");var G=document.createElementNS(A,"rect");G.setAttributeNS(null,"width",10);G.setAttributeNS(null,"height",10);G.setAttributeNS(null,"fill","#ffffff");G.setAttributeNS(null,"stroke","green");G.setAttributeNS(null,"stroke-width","1");var Q=document.createElementNS(A,"rect");Q.setAttributeNS(null,"width",10);Q.setAttributeNS(null,"height",10);Q.setAttributeNS(null,"fill","#ffffff");Q.setAttributeNS(null,"stroke","green");Q.setAttributeNS(null,"stroke-width","1");var h=document.createElementNS(A,"rect");h.setAttributeNS(null,"width",10);h.setAttributeNS(null,"height",10);h.setAttributeNS(null,"fill","#ffffff");h.setAttributeNS(null,"stroke","green");h.setAttributeNS(null,"stroke-width","1");R.setAttributeNS(null,"x",L.x-10-5);R.setAttributeNS(null,"y",L.y-10-5);P.setAttributeNS(null,"x",L.x+L.width+5);P.setAttributeNS(null,"y",L.y-10-5);O.setAttributeNS(null,"x",L.x+L.width+5);O.setAttributeNS(null,"y",L.y+L.height+5);N.setAttributeNS(null,"x",L.x-10-5);N.setAttributeNS(null,"y",L.y+L.height+5);g.setAttributeNS(null,"x",L.x+(L.width/2)-5);g.setAttributeNS(null,"y",L.y-10-5);G.setAttributeNS(null,"x",L.x+L.width+5);G.setAttributeNS(null,"y",L.y+(L.height/2)-5);Q.setAttributeNS(null,"x",L.x+(L.width/2)-5);Q.setAttributeNS(null,"y",L.y+L.height+5);h.setAttributeNS(null,"x",L.x-10-5);h.setAttributeNS(null,"y",L.y+(L.height/2)-5);U.appendChild(a);var I="#ff0000";var E="#ffffff";C.addEventListener("mouseover",function(T){C.setAttributeNS(null,"cursor","s-resize");C.setAttributeNS(null,"fill",I);typeTransform="Rotate";scaleType="nw"},false);C.addEventListener("mouseout",function(T){C.setAttributeNS(null,"cursor","default");C.setAttributeNS(null,"fill",E);typeTransform="Rotate"},false);c.addEventListener("mouseover",function(T){c.setAttributeNS(null,"cursor","move");c.setAttributeNS(null,"fill",I);typeTransform="spï¿½nCenter";scaleType="nw"},false);c.addEventListener("mouseout",function(T){c.setAttributeNS(null,"cursor","default");c.setAttributeNS(null,"fill",E);typeTransform=""},false);R.addEventListener("mouseover",function(T){R.setAttributeNS(null,"cursor","nw-resize");R.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="nw"},false);R.addEventListener("mouseout",function(T){R.setAttributeNS(null,"cursor","default");R.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);P.addEventListener("mouseover",function(T){P.setAttributeNS(null,"cursor","ne-resize");P.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="ne"},false);P.addEventListener("mouseout",function(T){P.setAttributeNS(null,"cursor","default");P.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);O.addEventListener("mouseover",function(T){O.setAttributeNS(null,"cursor","se-resize");O.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="se"},false);O.addEventListener("mouseout",function(T){O.setAttributeNS(null,"cursor","default");O.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);N.addEventListener("mouseover",function(T){N.setAttributeNS(null,"cursor","sw-resize");N.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="sw"},false);N.addEventListener("mouseout",function(T){N.setAttributeNS(null,"cursor","default");N.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);g.addEventListener("mouseover",function(T){g.setAttributeNS(null,"cursor","n-resize");g.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="n"},false);g.addEventListener("mouseout",function(T){g.setAttributeNS(null,"cursor","default");g.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);G.addEventListener("mouseover",function(T){G.setAttributeNS(null,"cursor","e-resize");G.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="e"},false);G.addEventListener("mouseout",function(T){G.setAttributeNS(null,"cursor","default");G.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);Q.addEventListener("mouseover",function(T){Q.setAttributeNS(null,"cursor","s-resize");Q.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="s"},false);Q.addEventListener("mouseout",function(T){Q.setAttributeNS(null,"cursor","default");Q.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);h.addEventListener("mouseover",function(T){h.setAttributeNS(null,"cursor","w-resize");h.setAttributeNS(null,"fill",I);typeTransform="Scale";scaleType="w"},false);h.addEventListener("mouseout",function(T){h.setAttributeNS(null,"cursor","default");h.setAttributeNS(null,"fill",E);typeTransform="Scale"},false);U.setAttributeNS(null,"transform",S);U.appendChild(C);if(B.tagName=="text"){U.appendChild(R);U.appendChild(P);U.appendChild(O);U.appendChild(N)}else{U.appendChild(R);U.appendChild(P);U.appendChild(O);U.appendChild(N);U.appendChild(g);U.appendChild(G);U.appendChild(Q);U.appendChild(h)}if(f){W.setAttributeNS(null,"transform",S);F.appendChild(W)}else{F.appendChild(U)}this.svgRoot.appendChild(F)};SVGRenderer.prototype.getMarkup=function(){return this.container.innerHTML};var rotatexxx=0;var scaleType="";var xrot=0;var yrot=0;var point={x:0,y:0,width:0,height:0};function createPoint(B,D,C,A){point={x:B,y:D,width:C,height:A};return point}SVGRenderer.prototype.restruct=function(A){};SVGRenderer.prototype.transform=function(){};SVGRenderer.prototype.scaleShape=function(Z,W,d,a){var O=Z.getBBox();var F=W.getBBox();var AC=O.x+(O.width/2);var AA=O.y+(O.height/2);var X=this.editor.inputxy;d=parseFloat(X[0]);a=parseFloat(X[1]);var K=dist2p(AC,AA,d,a);var AP=dist2p(O.x,O.y,d,a);var t=O.width/AP;var g="";var AL,AK,AN,b;if(scaleType.length==1){if(scaleType=="w"){g=t+",1";AL=d;AK=F.y;var M=F.x-d;var AE=M+F.width;if(AE<1){AE=1}AN=AE;th=F.height}if(scaleType=="e"){g=t+",1";AL=F.x;AK=F.y;var M=d-(F.x+F.width);var AE=M+F.width;if(AE<1){AE=1}AN=AE;th=F.height}if(scaleType=="n"){g="1,"+t;AL=F.x;AK=a;var M=F.y-a;var AO=M+F.height;if(AO<1){AO=1}AN=F.width;th=AO}if(scaleType=="s"){g="1,"+t;AL=F.x;AK=F.y;var M=a-(F.y+F.height);var AO=M+F.height;if(AO<1){AO=1}AN=F.width;th=AO}}if(scaleType.length==2){if(scaleType=="nw"){g=t+","+t;var AQ=ang2v(F.x,F.y,F.x+F.width,F.y+F.height);var H=F.x;var E=F.y;var AF=F.x+F.width;var AD=F.y+F.height;var f=d;var c=a;var L=d+10*Math.cos(AQ+(Math.PI/2));var J=a+10*Math.sin(AQ+(Math.PI/2));var I=ntrsccn2rb(H,E,AF,AD,f,c,L,J);this.editor.log(AQ*180/Math.PI);var AL=I[1];var AK=I[2];var H=I[1];var E=I[2];var AF=0;var AD=I[2];var f=F.x+F.width;var c=F.y;var L=F.x+F.width;var J=0;var G=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var U=dist2p(I[1],I[2],G[1],G[2]);var H=I[1];var E=I[2];var AF=I[1];var AD=0;var f=F.x;var c=F.y+F.height;var L=0;var J=F.y+F.height;var B=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var S=dist2p(I[1],I[2],B[1],B[2]);if(U<1){U=1}if(S<1){S=1}AN=U;th=S}if(scaleType=="se"){g=t+","+t;var AQ=ang2v(F.x,F.y,F.x+F.width,F.y+F.height);var H=F.x;var E=F.y;var AF=F.x+F.width;var AD=F.y+F.height;var f=d;var c=a;var L=d+10*Math.cos(AQ+(Math.PI/2));var J=a+10*Math.sin(AQ+(Math.PI/2));var I=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var A="http://www.w3.org/2000/svg";var x=document.getElementById("tracker");var AL=F.x;var AK=F.y;var H=I[1];var E=I[2];var AF=0;var AD=I[2];var f=F.x;var c=F.y;var L=F.x;var J=0;var G=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var U=dist2p(I[1],I[2],G[1],G[2]);var H=I[1];var E=I[2];var AF=I[1];var AD=0;var f=F.x;var c=F.y;var L=0;var J=F.y;var B=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var S=dist2p(I[1],I[2],B[1],B[2]);if(U<1){U=1}if(S<1){S=1}AN=U;th=S}if(scaleType=="ne"){g=t+","+t;var AQ=ang2v(F.x,F.y+F.height,F.x+F.width,F.y);var H=F.x;var E=F.y+F.height;var AF=F.x+F.width;var AD=F.y;var f=d;var c=a;var L=d+10*Math.cos(AQ+(Math.PI/2));var J=a+10*Math.sin(AQ+(Math.PI/2));this.editor.log(AQ);var I=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var A="http://www.w3.org/2000/svg";var x=document.getElementById("tracker");var AL=F.x;var AK=I[2];var H=I[1];var E=I[2];var AF=0;var AD=I[2];var f=F.x;var c=F.y;var L=F.x;var J=0;var G=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var U=dist2p(I[1],I[2],G[1],G[2]);var H=I[1];var E=I[2];var AF=I[1];var AD=0;var f=F.x;var c=F.y+F.height;var L=0;var J=F.y+F.height;var B=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var S=dist2p(I[1],I[2],B[1],B[2]);if(U<1){U=1}if(S<1){S=1}AN=U;th=S}if(scaleType=="sw"){g=t+","+t;var AQ=ang2v(F.x,F.y+F.height,F.x+F.width,F.y);var H=F.x;var E=F.y+F.height;var AF=F.x+F.width;var AD=F.y;var f=d;var c=a;var L=d+10*Math.cos(AQ+(Math.PI/2));var J=a+10*Math.sin(AQ+(Math.PI/2));this.editor.log(AQ);var I=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var A="http://www.w3.org/2000/svg";var x=document.getElementById("tracker");var AL=I[1];var AK=F.y;var H=I[1];var E=I[2];var AF=0;var AD=I[2];var f=F.x+F.width;var c=F.y+F.height;var L=F.x+F.width;var J=0;var G=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var U=dist2p(I[1],I[2],G[1],G[2]);var H=I[1];var E=I[2];var AF=I[1];var AD=0;var f=F.x;var c=F.y;var L=0;var J=F.y;var B=ntrsccn2rb(H,E,AF,AD,f,c,L,J);var S=dist2p(I[1],I[2],B[1],B[2]);if(U<1){U=1}if(S<1){S=1}AN=U;th=S}}if(Z.tagName=="rect"){Z.setAttributeNS(null,"x",AL);Z.setAttributeNS(null,"y",AK);Z.setAttributeNS(null,"width",AN);Z.setAttributeNS(null,"height",th)}else{if(Z.tagName=="text"){var e=Z.getAttributeNS(null,"font-size");e=parseFloat(e);var V=parseInt(Math.round(th));if(scaleType=="ne"){Z.setAttributeNS(null,"font-size",e+1)}}else{if(Z.tagName=="ellipse"){Z.setAttributeNS(null,"cx",(AL+(O.width/2))+"px");Z.setAttributeNS(null,"cy",(AK+(O.height/2))+"px");Z.setAttributeNS(null,"rx",(AN/2)+"px");Z.setAttributeNS(null,"ry",(th/2)+"px")}else{if(Z.tagName=="line"){Z.setAttributeNS(null,"x1",AL+"px");Z.setAttributeNS(null,"y1",AK+"px");Z.setAttributeNS(null,"x2",AL+AN+"px");Z.setAttributeNS(null,"y2",AK+th+"px")}else{if(Z.tagName=="polyline"){}else{if(Z.tagName=="image"){Z.setAttributeNS(null,"x",AL);Z.setAttributeNS(null,"y",AK);Z.setAttributeNS(null,"width",AN);Z.setAttributeNS(null,"height",th)}else{if(Z.tagName=="path"){var r=AN/O.width;var D=th/O.height;var N=r;var s=D/AK;if(scaleType=="n"){AL=O.x+(O.width/2);AK=O.y+O.height;var N=1;var s=O.y/a}if(scaleType=="s"){AL=O.x+(O.width/2);AK=O.y;var N=1;var s=a/(O.y+O.height)}if(scaleType=="e"){AL=O.x;AK=O.y+(O.height/2);var N=d/(O.x+O.width);var s=1}if(scaleType=="w"){AL=O.x+O.width;AK=O.y+(O.height/2);var N=O.x/d;var s=1}if(scaleType=="ne"){AL=O.x;AK=O.y+O.height;var N=d/(O.x+O.width);var s=N}if(scaleType=="nw"){AL=O.x+O.width;AK=O.y+O.height;var N=O.x/d;var s=N}if(scaleType=="se"){AL=O.x;AK=O.y;var N=d/(O.x+O.width);var s=N}if(scaleType=="sw"){AL=(O.x+O.width);AK=O.y;var N=O.x/d;var s=N}if(N==0){N=1e-7}if(s==0){s=1e-7}var z=W.getAttributeNS(null,"d");var AH=Z.getAttributeNS(null,"d");AH=AH.replace(/, /g,",");AH=AH.replace(/ ,/g,",");var R=AH.split(" ");var y="";var u=R[0].split(",");var p=parseFloat(u[0].substring(1));var o=parseFloat(u[1]);var AG=ang2v(O.x,O.y,AL,AK);var Y=Math.round((AG/Math.PI*2)*360);var Q=Math.cos(AG);var P=Math.sin(AG);var M=dist2p(AL,AK,O.x,O.y);var AB=/^[-]?\d*\.?\d*$/;var k=$V([AL,AK]);for(var AM=0;AM<R.length;AM++){if(R[AM].indexOf(",")>0){var u=R[AM].split(",");var v=u[0].substring(0,1);if(v=="A"||v=="a"){isArc=true;contArc=0}if(isArc==true){contArc++}if(contArc==4){contArc=0;isArc=false}if(!v.match(AB)){var p=parseFloat(u[0].substring(1));var q=v}else{if(isArc==true&&contArc==2){var p=u[0]}else{var p=parseFloat(u[0])}var q=""}if(isArc==true&&contArc==2){u[1]=u[1].toString()}else{u[1]=parseFloat(u[1]);var T=$V([p,u[1],1]);var l=$M([[1,0,-AL],[0,1,-AK],[0,0,1]]);var m=$M([[N,0,0],[0,s,0],[0,0,1]]);var n=$M([[1,0,AL],[0,1,AK],[0,0,1]]);var AJ=l.x(T);var AI=m.x(AJ);var C=n.x(AI);p=C.elements[0];u[1]=C.elements[1]}var f=p;var c=u[1];y+=q+f+","+c+" "}else{y+=R[AM]+" "}}Z.setAttributeNS(null,"d",y)}}}}}}}};SVGRenderer.prototype.rotateShape=function(N,K,P,O){var F=N.getBBox();var B=K.getBBox();var Z=F.x+(F.width/2);var Y=F.y+(F.height/2);var L=this.editor.inputxy;var W=ang2v(Z,Y,L[0],L[1]);if(xrot<P){rotatexxx+=1}else{rotatexxx-=1}xrot=P;yrot=O;var A=0;var k=0;var F=N.getBBox();var E=F.x;var D=F.y;P+=A;O+=A;var R=parseFloat(F.x/2);var Q=parseFloat(F.y/2);var U=Math.atan2(P,O);var M=U*180/Math.PI;var C=N.getCTM();var h=C.a*(180/Math.PI);var M=h*180/Math.PI;var o=W*180/Math.PI;this.editor.log(Z+" "+Y+" "+L[0]+" "+L[1]+"____ "+o+" "+W*180/Math.PI);N.setAttributeNS(null,"transform","rotate("+o+","+(B.x+(B.width/2))+","+(B.y+(B.height/2))+")");var J=C.e;var t=C.f;var H=Math.sin(rotatexxx*(Math.PI/180));var S=Math.cos(rotatexxx*(Math.PI/180));var I=0+g*rotatexxx*(Math.PI/180);var s=0;var g=0;var q=S;var n=H;var l=C.e;var p=C.b;var m=(-J*S+t*H+I);var i=(-J*H-t*S+s);var X=C.inverse;var G=C.multiply(X);var V="matrix("+G.a+" "+G.b+" "+G.c+" "+G.d+" "+G.e+" "+G.f+")"};SVGRenderer.prototype.getshapes=function(){return this.svgRoot.childNodes};function generateJSON(E){var C=E.trim().split(";"),D=[],A="";for(var B=0;B<C.length;B++){A=C[B].trim().split(":");if(A[0]&&A[1]&&A[0].length>1&&A[1].length>1){D.push(['"',A[0].toString().trim(),'": "',A[1].toString().trim(),'"'].join(""))}}return"{"+D.join(",")+"}"}function VMLRenderer(){this.base=AbstractRenderer}VMLRenderer.prototype=new AbstractRenderer;VMLRenderer.prototype.init=function(B){this.container=B;this.container.unselectable="on";B.ownerDocument.namespaces.add("v","urn:schemas-microsoft-com:vml");var A=B.ownerDocument.createStyleSheet();A.addRule("v\\:*","behavior: url(#default#VML);")};VMLRenderer.prototype.bounds=function(A){var B=new Object();B.x=A.offsetLeft;B.y=A.offsetTop;B.width=A.offsetWidth;B.height=A.offsetHeight;return B};VMLRenderer.prototype.create=function(D,I,C,W,E,A,H,R,V,T,Z,S,K,U,b,Q,N){var B;var L=1;if(D=="rect"){B=this.container.ownerDocument.createElement("v:rect");B.style.position="absolute";B.style.left=H;B.style.top=R;B.style.width=V;B.style.height=T;if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}}else{if(D=="roundrect"){B=this.container.ownerDocument.createElement("v:roundrect");B.style.position="absolute";B.style.left=H;B.style.top=R;B.style.width=V;B.style.height=T;B.setAttribute("arcsize","20%");if(I!=""){B.setAttribute("filled","true"||I!="none");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}}else{if(D=="ellipse"){B=this.container.ownerDocument.createElement("v:oval");B.style.left=H;B.style.top=R;B.style.width=V;B.style.height=T;B.style.position="absolute";if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}}else{if(D=="line"){B=this.container.ownerDocument.createElement("v:line");B.style.position="absolute";B.setAttribute("from",H+"px,"+R+"px");B.setAttribute("to",(H+V)+"px,"+(R+T)+"px")}else{if(D=="polyline"){B=this.container.ownerDocument.createElement("v:polyline");var G="M "+xpArray[1]+", "+ypArray[1]+" l";var O=xpArray.length;for(var c=2;c<O;c++){G+=" "+xpArray[c]+", "+ypArray[c]}B.setAttribute("points",b);if(I!=""){B.setAttribute("filled","true"||I!="none");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}}else{if(D=="path"){B=this.container.ownerDocument.createElement("v:shape");var F=" ";var G=" "+xpArray[1]+","+ypArray[1]+" l";var O=xpArray.length;for(var c=2;c<O;c++){F+=" "+xpArray[c]+","+ypArray[c]}var Y=this.container.ownerDocument.createElement("v:path");Y.setAttribute("v",b);B.style.position="absolute";B.style.width=700+"px";B.style.height=500+"px";B.style.left="0px";B.style.top="0px";B.setAttribute("coordsize","700,500");if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}B.appendChild(Y)}else{if(D=="controlpath"){B=this.container.ownerDocument.createElement("v:shape");B.style.position="absolute";B.style.width=700+"px";B.style.height=500+"px";B.style.left=H+"px";B.style.top=R+"px";B.setAttribute("coordsize","700,500");var Y=this.container.ownerDocument.createElement("v:path");Y.setAttribute("v","m "+H+","+R+" c"+(H+1)+","+(R+1)+" e ");if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}B.appendChild(Y)}else{if(D=="image"){var f=U;B=this.container.ownerDocument.createElement("v:image");B.setAttribute("src",U);B.style.position="absolute";B.style.width=V+"px";B.style.height=T+"px";B.style.left=H+"px";B.style.top=R+"px";B.style.margin=0+"px";B.style.padding=0+"px";if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}B.setAttribute("strokeweight",parseFloat(A)+"px");B.setAttribute("stroked","true");B.setAttribute("strokecolor",C)}else{if(D=="textpath"){var f=Z;B=this.container.ownerDocument.createElement("v:shape");B.style.position="absolute";coordorigin="0, 0";B.style.width=100+"px";B.style.height=100+"px";B.style.left=H+"px";B.style.top=R+"px";B.style.margin=0+"px";B.style.padding=0+"px";if(I!=""||I!="none"){B.setAttribute("filled","true");B.setAttribute("fillcolor",I)}else{B.setAttribute("filled","false")}if(A==0||A=="none"||C=="none"){B.setAttribute("stroked","false")}else{B.setAttribute("stroked","true");B.setAttribute("strokeweight",parseFloat(A)+"px");B.setAttribute("strokecolor",C)}B.setAttribute("path","m "+0+" "+0+" r "+(700)+" "+0+" e");var X=this.container.ownerDocument.createElement("v:textpath");X.setAttribute("string",f);X.setAttribute("fitshape","false");X.setAttribute("trim","false");X.setAttribute("fitpath","false");X.setAttribute("on","true");X.style.fontFamily=K;X.style.fontSize=parseFloat(S)+"px";X.setAttribute("vTextKern","true");X.setAttribute("text-align","right");var P=this.container.ownerDocument.createElement("v:path");P.setAttribute("textpathok","true");B.appendChild(X);B.appendChild(P)}else{if(D=="text"){B=this.container.ownerDocument.createElement("v:shape");B.style.position="absolute";B.style.coordsize=1000+", "+1000;B.style.width=1000;B.style.height=1000;B.style.left=H;B.style.top=R-parseFloat(S);B.style.padding=0;var e=this.container.ownerDocument.createElement("v:textbox");var J=this.container.ownerDocument.createElement("div");J.style.coordorigin=0+", "+(0);J.style.margin=0;J.style.fontFamily=K;J.style.margin=0;J.style.padding=0;J.style.fontSize=parseFloat(S);J.style.color="#000000";J.innerHTML=Z;e.appendChild(J);B.appendChild(e)}else{if(D=="group"){B=this.container.ownerDocument.createElement("v:group");B.style.left=H+"px";B.style.top=R+"px"}}}}}}}}}}}if(D=="zoom"){}else{if(Q!=""){}if(D!="image"){if(A==0||A=="none"||C=="none"){B.setAttribute("stroked","false")}else{B.setAttribute("stroked","true");B.setAttribute("strokecolor",C);B.setAttribute("strokeweight",A);var M=this.container.ownerDocument.createElement("v:stroke");M.setAttribute("opacity",parseFloat(E));B.appendChild(M)}if(I!=""||I!="none"){var a=this.container.ownerDocument.createElement("v:fill");a.setAttribute("opacity",parseFloat(W));B.appendChild(a)}}}if(N==""){this.container.appendChild(B)}else{var d=document.getElementById(N);d.appendChild(B)}return B};VMLRenderer.prototype.datacreate=function(C,J,I,E,K,D,L,H){var A;var B=/[ ,]/;A=this.container.ownerDocument.createElement("v:shape");var G=this.container.ownerDocument.createElement("v:path");var M=H;M=M.replace(/c/g,"v");M=M.replace(/z/g,"x");if(M.search(/\./)>-1){pathitems=M.split(B);for(var F=0;F<pathitems.length;F++){if(isNaN(parseFloat(pathitems[F]))==false){pathitems[F]=Math.round(pathitems[F])}}M=pathitems.join(" ")}G.setAttribute("v",M);A.style.position="absolute";A.style.width="21600";A.style.height="21600";A.style.left="0px";A.style.top="0px";A.setAttribute("coordsize","21600,21600");if(C!=""){A.setAttribute("filled","true");A.setAttribute("fillcolor",C)}else{A.setAttribute("filled","false")}A.appendChild(G);this.container.appendChild(A);return A};VMLRenderer.prototype.index=function(C,B){if(B==-1){this.container.appendChild(C)}if(B==0){this.container.insertBefore(C,C.parentNode.firstChild)}if(B==1||B==2){var G=C.getAttribute("id");var F=this.container.childNodes.length;var D=0;for(var E=1;E<F;E++){var A=this.container.childNodes[E].getAttribute("id");if(A==G){D=E}}if(B==1){if((D-1)>=-1){this.container.insertBefore(C,this.container.childNodes[D-1])}}if(B==2){if((D+1)<F){this.container.insertBefore(C,this.container.childNodes[D+2])}}}};VMLRenderer.prototype.remove=function(A){if(A!=null){A.removeNode(true)}};VMLRenderer.prototype.removeAll=function(){while(this.container.hasChildNodes()){this.container.removeChild(this.container.firstChild)}};VMLRenderer.prototype.copy=function(B){var A;A=B.cloneNode(false);return A};VMLRenderer.prototype.paste=function(A,C,B){this.container.appendChild(A);return A};VMLRenderer.prototype.duplicate=function(B){var A;A=B.cloneNode(false);A.setAttribute("fillcolor","#aa00aa");this.container.appendChild(A);return A};VMLRenderer.prototype.undo=function(){this.container.removeChild(this.container.lastChild)};var left1=0;var top1=0;var pati;var pathid,pathini;VMLRenderer.prototype.move=function(A,D,C,E,B){typeTransform="Translate";if(A.tagName=="line"){A.style.marginLeft=D;A.style.marginTop=C}if(A.tagName=="polyline"){A.style.marginLeft=D;A.style.marginTop=C}if(A.tagName=="oval"){A.style.left=D;A.style.top=C}if(A.tagName=="rect"){A.style.left=D;A.style.top=C}if(A.tagName=="image"){A.style.left=D;A.style.top=C}if(A.tagName=="shape"){A.style.left=D+"px";A.style.top=C+"px"}};VMLRenderer.prototype.track=function(A){};VMLRenderer.prototype.clic=function(B){var A="";if(data_path_close==true){A=" "}var E="m "+setPoints[0]+" l";var D=setPoints.length;for(var F=1;F<D;F++){E+=setPoints[F]+" "}var C=E+A+" e";B.style.position="absolute";B.style.width=700+"px";B.style.height=500+"px";B.style.left="0px";B.style.top="0px";B.children[0].setAttribute("v",C)};VMLRenderer.prototype.resize=function(H,M,I,N,J){var C=N-M;var B=J-I;var P=1;if(H.tagName=="line"){P=0}if(H.tagName=="polyline"){P=2}if(H.tagName=="line"){H.setAttribute("to",N+"px,"+J+"px")}if(P==1){if(C<0){H.style.left=N+"px";H.style.width=-C+"px"}else{H.style.width=C+"px"}if(B<0){H.style.top=J+"px";H.style.height=-B+"px"}else{H.style.height=B+"px"}}if(P==2){xpArray.push(N);ypArray.push(J);var L=" "+xpArray[1]+","+ypArray[1];var E=xpArray.length;for(var K=2;K<E;K++){L+=" "+xpArray[K]+","+ypArray[K]}H.points.Value=L}if(H.tagName=="shape"){if(selectmode=="controlpath"){var A="";if(data_path_close==true){A=" "}var L="m "+setPoints[0]+" l";var E=setPoints.length;for(var K=1;K<E;K++){L+=setPoints[K]+" "}var O=L+N+","+J+A+" e";H.style.position="absolute";H.style.width=700+"px";H.style.height=500+"px";H.style.left="0px";H.style.top="0px";H.children[0].setAttribute("v",O)}else{xpArray.push(N);ypArray.push(J);var F="";var G=" "+xpArray[1]+","+ypArray[1];var E=xpArray.length;for(var K=2;K<E;K++){F+=""+xpArray[K]+","+ypArray[K]+",";if((K+2)%3==0){F+=""}}F+=""+xpArray[E]+","+ypArray[E]+"";var D=this.container.ownerDocument.createElement("v:path");D.setAttribute("v","m"+G+" l"+F+" e");if(H.children[0].tagName=="textpath"){var D=this.container.ownerDocument.createElement("v:path");D.setAttribute("v","m 100 100 l 600 100 e");H.style.width=100+"px";H.style.height=100+"px";H.style.left=N+"px";H.style.top=J+"px";H.style.margin=0+"px";H.style.padding=0+"px";H.appendChild(D)}else{H.style.position="absolute";H.style.width=700+"px";H.style.height=500+"px";H.style.left="0px";H.style.top="0px";H.appendChild(D)}}}};VMLRenderer.prototype.tocurve=function(){};VMLRenderer.prototype.info=function(A){var B={};B.id=A.id;B.type=A.tagName;if(A.tagName=="rect"){B.left=parseFloat(A.style.left);B.top=parseFloat(A.style.top);B.width=parseFloat(A.style.width);B.height=parseFloat(A.style.height)}else{if(A.tagName=="oval"){B.width=parseFloat(A.getAttribute("rx"))*2;B.height=parseFloat(A.getAttribute("ry"))*2;B.left=(B.width*2)-parseFloat(A.getAttribute("rx"));B.top=(B.height*2)-parseFloat(A.getAttribute("ry"))}else{if(A.tagName=="roundrect"){B.left=parseFloat(A.getAttribute("x"));B.top=parseFloat(A.getAttribute("y"));B.width=parseFloat(A.getAttribute("width"));B.height=parseFloat(A.getAttribute("height"))}else{if(A.tagName=="line"){B.left=parseFloat(A.getAttribute("x1"));B.top=parseFloat(A.getAttribute("y1"))}else{if(A.tagName=="polyline"){B.points=A.getAttribute("points")}else{if(A.tagName=="image"){B.left=parseFloat(A.getAttribute("x"));B.top=parseFloat(A.getAttribute("y"));B.width=parseFloat(A.getAttribute("width"));B.height=parseFloat(A.getAttribute("height"));B.src=A.getAttribute("src")}else{if(A.tagName=="shape"){if(A.children[0].tagName=="path"){B.d=A.getAttribute("v")}if(A.children[0].tagName=="textpath"){B["font-family"]=A.children[0].getAttribute("font-family");B["font-size"]=parseInt(A.children[0].getAttribute("font-size"));B.top=parseFloat(A.children[0].getAttribute("y"));B.left=parseFloat(A.children[0].getAttribute("x"));B.text=A.textContent}}}}}}}}return B};VMLRenderer.prototype.transformShape=function(A,E,B){if(A.tagName=="rect"){var D=this.bounds(A);var C=E.split(";");A.style.top=parseFloat(C[0])+"px";A.style.left=parseFloat(C[1])+"px";A.style.width=parseFloat(C[2])+"px";A.style.height=parseFloat(C[3])+"px";A.style.rotation=parseFloat(C[4])}else{if(A.tagName=="text"){if(E.indexOf("<;>",0)==-1){A.textContent=E}else{var C=E.split("<;>");A.textContent=C[0];A.setAttribute("font-size",parseFloat(C[1]));A.setAttribute("font-family",C[2])}}else{if(A.tagName=="polyline"){A.setAttribute("points",E)}else{if(A.tagName=="image"){if(E.indexOf(";",0)==-1){A.setAttribute("src",E)}else{var D=this.bounds(A);var C=E.split(";");A.style.top=parseFloat(C[0])+"px";A.style.left=parseFloat(C[1])+"px";A.style.width=parseFloat(C[2])+"px";A.style.height=parseFloat(C[3])+"px";var G=parseFloat(C[0])+parseFloat(D.width/2);var F=parseFloat(C[1])+parseFloat(D.height/2);A.style.rotation=parseFloat(C[4])}}else{if(A.tagName=="path"){if(E.indexOf(";",0)==-1){}else{var D=this.bounds(A);var C=E.split(";");var G=parseFloat(C[0])+parseFloat(D.width/2);var F=parseFloat(C[1])+parseFloat(D.height/2)}}}}}}};VMLRenderer.prototype.editShape=function(A,B){if(A.tagName=="text"){A.textContent=B}else{if(A.tagName=="polyline"){A.setAttribute("points",B)}else{if(A.tagName=="path"){A.setAttribute("v",B)}}}};VMLRenderer.prototype.editCommand=function(A,C,B){if(A!=null){if(C=="fillcolor"){if(B!=""){A.filled="true";A.fillcolor=B}else{A.filled="false";A.fillcolor=""}}else{if(C=="linecolor"){if(B!=""){A.stroked="true";A.strokecolor=B}else{A.stroked="false";A.strokecolor=""}}else{if(C=="linewidth"){A.strokeweight=parseInt(B)+"px"}else{if(C=="fillopacity"){A.fill.opacity=parseFloat(B)}}}}}};VMLRenderer.prototype.queryCommand=function(A,B){if(A!=null){if(B=="fillcolor"){if(A.filled=="false"){return""}else{return A.fillcolor}}else{if(B=="linecolor"){if(A.stroked=="false"){return""}else{return A.strokecolor}}else{if(B=="linewidth"){if(A.stroked=="false"){return""}else{return(parseFloat(A.strokeweight)*(screen.logicalXDPI/72))+"px"}}}}}};VMLRenderer.prototype.getProperties=function(A){};VMLRenderer.prototype.showMultiSelect=function(B,A){var C=document.getElementById("trackerMultiSelect");if(C){this.remove(C)}var D=this.editor.inputxy;toX=parseFloat(D[0]);toY=parseFloat(D[1]);C=this.container.ownerDocument.createElement("v:rect");C.style.position="relative";C.style.left=B;C.style.top=A;C.style.width=toX;C.style.height=toY;C.setAttribute("filled","false");C.setAttribute("stroked","true");C.setAttribute("strokecolor","blue");C.setAttribute("strokeweight","1px");this.container.appendChild(C)};VMLRenderer.prototype.showNodesCurve=function(F){var C=F.split("c");var B="";var E=" ";var D=C.length-1;for(var A=1;A<D;A++){E=C[A].split(" ");B+=E[0]+" "}$("someinfo").value=D+" nodes ";return B};VMLRenderer.prototype.showTracker=function(A){var K=this.bounds(A);var Q=parseFloat(A.getAttribute("rotation"));var E=document.getElementById("tracker");if(E){this.remove(E)}if(A.tagName=="shape"){shap=2;if(A.children[0].tagName=="path"){var R=A.children[0].getAttribute("v");$("control_codebase").value=R}}if(A.tagName=="rect"){}if(A.tagName=="image"){}if(A.tagName=="text"){}if(A.tagName=="line"){}if(A.tagName=="oval"){}E=this.container.ownerDocument.createElement("v:group");E.id="tracker";E.setAttribute("coordorigin","0, 0");E.setAttribute("coordsize",K.width+","+K.height);E.style.position="absolute";E.style.left=K.x;E.style.top=K.y;E.style.width=K.width;E.style.height=K.height;var S=[];var T=createPoint(K.x,K.y,K.width,K.height);S.push(createPoint(K.x+K.width,K.y,K.width,K.height));T.x=K.x+K.width;T.y=K.y;S.push(createPoint(K.x+K.width,K.y+K.height,K.width,K.height));T.x=K.x+K.width;T.y=K.y+K.height;S.push(createPoint(K.x,K.y+K.height,K.width,K.height));T.x=K.x;T.y=K.y+K.height;S.push(createPoint(K.x+K.width,K.y,K.width,K.height));var V=createPoint(S[0].x,S[0].y);var U=createPoint(S[0].x,S[0].y);for(var W=1;W<S.length;W++){var J=S[W].x;var I=S[W].y;if(J<U.x){U.x=J}else{if(J>V.x){V.x=J}}if(I<U.y){U.y=I}else{if(I>V.y){V.y=I}}}var B=this.container.ownerDocument.createElement("v:rect");B.style.position="relative";B.style.left=0-10;B.style.top=0-10;B.style.width=K.width+20;B.style.height=K.height+20;B.setAttribute("filled","false");B.setAttribute("stroked","true");B.setAttribute("strokecolor","blue");B.setAttribute("strokeweight","1px");var H=this.container.ownerDocument.createElement("v:polyline");H.style.position="relative";H.setAttribute("filled","false");H.setAttribute("stroked","true");H.setAttribute("strokecolor","blue");H.setAttribute("strokeweight","1px");H.setAttribute("points",(K.width+10)+","+((K.height/2))+", "+(K.width+10+25)+","+((K.height/2)));var C=this.container.ownerDocument.createElement("v:oval");C.style.position="relative";C.style.left=((K.width+40)-5);C.style.top=((K.height/2)-5);C.style.width=(10);C.style.height=(10);C.setAttribute("filled","true");C.setAttribute("stroked","true");C.setAttribute("fillcolor","#ffffff");C.setAttribute("strokecolor","green");C.setAttribute("strokeweight","1px");var P=this.container.ownerDocument.createElement("v:rect");P.style.position="relative";P.style.left=-10-5;P.style.top=-10-5;P.style.width=10;P.style.height=10;P.setAttribute("filled","true");P.setAttribute("stroked","true");P.setAttribute("fillcolor","#ffffff");P.setAttribute("strokecolor","green");P.setAttribute("strokeweight","1px");var N=this.container.ownerDocument.createElement("v:rect");N.style.position="relative";N.style.left=K.width+5;N.style.top=-10-5;N.style.width=10;N.style.height=10;N.setAttribute("filled","true");N.setAttribute("stroked","true");N.setAttribute("fillcolor","#ffffff");N.setAttribute("strokecolor","green");N.setAttribute("strokeweight","1px");var M=this.container.ownerDocument.createElement("v:rect");M.style.position="relative";M.style.left=K.width+5;M.style.top=K.height+5;M.style.width=10;M.style.height=10;M.setAttribute("filled","true");M.setAttribute("stroked","true");M.setAttribute("fillcolor","#ffffff");M.setAttribute("strokecolor","green");M.setAttribute("strokeweight","1px");var L=this.container.ownerDocument.createElement("v:rect");L.style.position="relative";L.style.left=-10-5;L.style.top=K.height+5;L.style.width=10;L.style.height=10;L.setAttribute("filled","true");L.setAttribute("stroked","true");L.setAttribute("fillcolor","#ffffff");L.setAttribute("strokecolor","green");L.setAttribute("strokeweight","1px");var X=this.container.ownerDocument.createElement("v:rect");X.style.position="relative";X.style.left=(K.width/2)-5;X.style.top=-10-5;X.style.width=10;X.style.height=10;X.setAttribute("filled","true");X.setAttribute("stroked","true");X.setAttribute("fillcolor","#ffffff");X.setAttribute("strokecolor","green");X.setAttribute("strokeweight","1px");var F=this.container.ownerDocument.createElement("v:rect");F.style.position="relative";F.style.left=K.width+5;F.style.top=(K.height/2)-5;F.style.width=10;F.style.height=10;F.setAttribute("filled","true");F.setAttribute("stroked","true");F.setAttribute("fillcolor","#ffffff");F.setAttribute("strokecolor","green");F.setAttribute("strokeweight","1px");var O=this.container.ownerDocument.createElement("v:rect");O.style.position="relative";O.style.left=(K.width/2)-5;O.style.top=K.height+5;O.style.width=10;O.style.height=10;O.setAttribute("filled","true");O.setAttribute("stroked","true");O.setAttribute("fillcolor","#ffffff");O.setAttribute("strokecolor","green");O.setAttribute("strokeweight","1px");var Y=this.container.ownerDocument.createElement("v:rect");Y.style.position="relative";Y.style.left=-10-5;Y.style.top=(K.height/2)-5;Y.style.width=10;Y.style.height=10;Y.setAttribute("filled","true");Y.setAttribute("stroked","true");Y.setAttribute("fillcolor","#ffffff");Y.setAttribute("strokecolor","green");Y.setAttribute("strokeweight","1px");var G="#ff0000";var D="#ffffff";C.attachEvent("onmouseover",function(Z){C.style.cursor="s-resize";C.setAttribute("fillcolor",G);typeTransform="Rotate";scaleType="nw"},false);C.attachEvent("onmouseout",function(Z){C.style.cursor="default";C.setAttribute("fillcolor",D);typeTransform="Rotate"},false);P.attachEvent("onmouseover",function(Z){P.style.cursor="nw-resize";P.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="nw"},false);P.attachEvent("onmouseout",function(Z){P.style.cursor="default";P.setAttribute("fillcolor",D);typeTransform="Scale"},false);N.attachEvent("onmouseover",function(Z){N.style.cursor="ne-resize";N.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="ne"},false);N.attachEvent("onmouseout",function(Z){N.style.cursor="default";N.setAttribute("fillcolor",D);typeTransform="Scale"},false);M.attachEvent("onmouseover",function(Z){M.style.cursor="se-resize";M.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="se"},false);M.attachEvent("onmouseout",function(Z){M.style.cursor="default";M.setAttribute("fillcolor",D);typeTransform="Scale"},false);L.attachEvent("onmouseover",function(Z){L.style.cursor="sw-resize";L.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="sw"},false);L.attachEvent("onmouseout",function(Z){L.style.cursor="default";L.setAttribute("fillcolor",D);typeTransform="Scale"},false);X.attachEvent("onmouseover",function(Z){X.style.cursor="n-resize";X.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="n"},false);X.attachEvent("onmouseout",function(Z){X.style.cursor="default";X.setAttribute("fillcolor",D);typeTransform=""},false);F.attachEvent("onmouseover",function(Z){F.style.cursor="e-resize";F.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="e"},false);F.attachEvent("onmouseout",function(Z){F.style.cursor="default";F.setAttribute("fillcolor",D);typeTransform=""},false);O.attachEvent("onmouseover",function(Z){O.style.cursor="s-resize";O.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="s"},false);O.attachEvent("onmouseout",function(Z){O.style.cursor="default";O.setAttribute("fillcolor",D);typeTransform=""},false);Y.attachEvent("onmouseover",function(Z){Y.style.cursor="w-resize";Y.setAttribute("fillcolor",G);typeTransform="Scale";scaleType="w"},false);Y.attachEvent("onmouseout",function(Z){Y.style.cursor="default";Y.setAttribute("fillcolor",D);typeTransform=""},false);E.appendChild(B);E.appendChild(H);E.appendChild(C);E.appendChild(P);E.appendChild(N);E.appendChild(M);E.appendChild(L);E.appendChild(X);E.appendChild(F);E.appendChild(O);E.appendChild(Y);this.container.appendChild(E)};VMLRenderer.prototype.getMarkup=function(){return this.container.innerHTML};var rotatexxx=0;var scaleType="";var xrot=0;var yrot=0;var point={x:0,y:0,width:0,height:0};function createPoint(B,D,C,A){point={x:B,y:D,width:C,height:A};return point}VMLRenderer.prototype.restruct=function(A){};VMLRenderer.prototype.transform=function(){};VMLRenderer.prototype.scaleShape=function(F,J,E,D){var N=this.bounds(F);var H=this.bounds(J);var W=N.x+(N.width/2);var U=N.y+(N.height/2);var V=this.editor.inputxy;E=parseFloat(V[0]);D=parseFloat(V[1]);var K=dist2p(W,U,E,D);var f=dist2p(N.x,N.y,E,D);var L=N.width/f;var S="";var e,d,g,i;if(scaleType.length==1){if(scaleType=="w"){S=L+",1";e=E;d=H.y;var T=H.x-E;var Q=T+H.width;if(Q<1){Q=1}g=Q;th=H.height}if(scaleType=="e"){S=L+",1";e=H.x;d=H.y;var T=E-(H.x+H.width);var Q=T+H.width;if(Q<1){Q=1}g=Q;th=H.height}if(scaleType=="n"){S="1,"+L;e=H.x;d=D;var T=H.y-D;var Y=T+H.height;if(Y<1){Y=1}g=H.width;th=Y}if(scaleType=="s"){S="1,"+L;e=H.x;d=H.y;var T=D-(H.y+H.height);var Y=T+H.height;if(Y<1){Y=1}g=H.width;th=Y}}if(scaleType.length==2){if(scaleType=="nw"){S=L+","+L;var a=ang2v(H.x,H.y,H.x+H.width,H.y+H.height);var P=H.x;var M=H.y;var Z=H.x+H.width;var X=H.y+H.height;var I=E;var G=D;var R=E+10*Math.cos(a+(Math.PI/2));var O=D+10*Math.sin(a+(Math.PI/2));var C=ntrsccn2rb(P,M,Z,X,I,G,R,O);var e=C[1];var d=C[2];var P=C[1];var M=C[2];var Z=0;var X=C[2];var I=H.x+H.width;var G=H.y;var R=H.x+H.width;var O=0;var B=ntrsccn2rb(P,M,Z,X,I,G,R,O);var c=dist2p(C[1],C[2],B[1],B[2]);var P=C[1];var M=C[2];var Z=C[1];var X=0;var I=H.x;var G=H.y+H.height;var R=0;var O=H.y+H.height;var A=ntrsccn2rb(P,M,Z,X,I,G,R,O);var b=dist2p(C[1],C[2],A[1],A[2]);if(c<1){c=1}if(b<1){b=1}g=c;th=b}if(scaleType=="se"){S=L+","+L;var a=ang2v(H.x,H.y,H.x+H.width,H.y+H.height);var P=H.x;var M=H.y;var Z=H.x+H.width;var X=H.y+H.height;var I=E;var G=D;var R=E+10*Math.cos(a+(Math.PI/2));var O=D+10*Math.sin(a+(Math.PI/2));var C=ntrsccn2rb(P,M,Z,X,I,G,R,O);var e=H.x;var d=H.y;var P=C[1];var M=C[2];var Z=0;var X=C[2];var I=H.x;var G=H.y;var R=H.x;var O=0;var B=ntrsccn2rb(P,M,Z,X,I,G,R,O);var c=dist2p(C[1],C[2],B[1],B[2]);var P=C[1];var M=C[2];var Z=C[1];var X=0;var I=H.x;var G=H.y;var R=0;var O=H.y;var A=ntrsccn2rb(P,M,Z,X,I,G,R,O);var b=dist2p(C[1],C[2],A[1],A[2]);if(c<1){c=1}if(b<1){b=1}g=c;th=b}if(scaleType=="ne"){S=L+","+L;var a=ang2v(H.x,H.y+H.height,H.x+H.width,H.y);var P=H.x;var M=H.y+H.height;var Z=H.x+H.width;var X=H.y;var I=E;var G=D;var R=E+10*Math.cos(a+(Math.PI/2));var O=D+10*Math.sin(a+(Math.PI/2));var C=ntrsccn2rb(P,M,Z,X,I,G,R,O);var e=H.x;var d=C[2];var P=C[1];var M=C[2];var Z=0;var X=C[2];var I=H.x;var G=H.y;var R=H.x;var O=0;var B=ntrsccn2rb(P,M,Z,X,I,G,R,O);var c=dist2p(C[1],C[2],B[1],B[2]);var P=C[1];var M=C[2];var Z=C[1];var X=0;var I=H.x;var G=H.y+H.height;var R=0;var O=H.y+H.height;var A=ntrsccn2rb(P,M,Z,X,I,G,R,O);var b=dist2p(C[1],C[2],A[1],A[2]);if(c<1){c=1}if(b<1){b=1}g=c;th=b}if(scaleType=="sw"){S=L+","+L;var a=ang2v(H.x,H.y+H.height,H.x+H.width,H.y);var P=H.x;var M=H.y+H.height;var Z=H.x+H.width;var X=H.y;var I=E;var G=D;var R=E+10*Math.cos(a+(Math.PI/2));var O=D+10*Math.sin(a+(Math.PI/2));var C=ntrsccn2rb(P,M,Z,X,I,G,R,O);var e=C[1];var d=H.y;var P=C[1];var M=C[2];var Z=0;var X=C[2];var I=H.x+H.width;var G=H.y+H.height;var R=H.x+H.width;var O=0;var B=ntrsccn2rb(P,M,Z,X,I,G,R,O);var c=dist2p(C[1],C[2],B[1],B[2]);var P=C[1];var M=C[2];var Z=C[1];var X=0;var I=H.x;var G=H.y;var R=0;var O=H.y;var A=ntrsccn2rb(P,M,Z,X,I,G,R,O);var b=dist2p(C[1],C[2],A[1],A[2]);if(c<1){c=1}if(b<1){b=1}g=c;th=b}}if(F.tagName=="rect"){F.style.left=e+"px";F.style.top=d+"px";F.style.height=th+"px";F.style.width=g+"px"}else{if(F.tagName=="text"){}else{if(F.tagName=="oval"){F.style.left=e+"px";F.style.top=d+"px";F.style.height=th+"px";F.style.width=g+"px"}else{if(F.tagName=="line"){F.setAttribute("to",e+"px,"+d+"px");F.setAttribute("from",g+"px,"+th+"px")}else{if(F.tagName=="polyline"){}else{if(F.tagName=="image"){F.style.left=e+"px";F.style.top=d+"px";F.style.height=th+"px";F.style.width=g+"px"}else{if(F.tagName=="shape"){F.style.left=e+"px";F.style.top=d+"px";F.style.height=th+"px";F.style.width=g+"px"}}}}}}}};VMLRenderer.prototype.rotateShape=function(C,E,B,A){var G=this.bounds(C);var D=this.bounds(E);var L=G.x+(G.width/2);var J=G.y+(G.height/2);var K=this.editor.inputxy;var Q=ang2v(L,J,K[0],K[1]);if(xrot<B){rotatexxx+=1}else{rotatexxx-=1}xrot=B;yrot=A;var F=0;var R=0;var I=G.x;var H=G.y;B+=F;A+=F;var O=parseFloat(G.x/2);var N=parseFloat(G.y/2);var M=Math.atan2(B,A);var P=M*180/Math.PI;C.setAttribute("rotation",P)};VMLRenderer.prototype.getshapes=function(){return this.container.childNodes};Ax.loadShapes=function(C,B,A){if(typeof C=="string"){C=Ext.util.JSON.decode(C)}else{if(typeof C=="undefined"){return }}for(var D=0;D<C.length;D++){Ax.loadShape(C[D],B,A)}};Ax.loadShape=function(C,B,A){var D=((A)?A:Ax.canvas).renderer.create(C.type,(C.fillColor)?C.fillColor:("#"+Ax.Color.fill),(C.lineColor)?C.lineColor:("#"+Ax.Color.line),(C.fillOpac)?C.fillOpac:1,(C.lineOpac)?C.lineOpac:1,(C.lineWidth)?C.lineWidth:Ax.Color.width,(C.left)?C.left:100,(C.top)?C.top:100,(C.width)?C.width:100,(C.height)?C.height:100,(C.text)?C.text:"",(C.textSize)?C.textSize:19,(C.textFamily)?C.textFamily:"Arial",(C.href)?C.href:"",(C.points)?C.points:"",(C.transform)?C.transform:"",(C.parent)?C.parent:"");D.id=(C.id)?C.id:createUUID();if(!B){Ext.get(D).on("mousedown",Ax.canvas.onHit,Ax.canvas)}};Ax.dumpshape=function(A){if(!A.getAttribute("transform")){try{var C=A.getBBox();A.setAttributeNS(null,"transform","rotate(0, "+(C.x+(C.width/2))+", "+(C.y+(C.height/2))+")")}catch(B){}}return Ax.canvas.info(A)};Ax.dumpshapes_core=function(){var A=Ax.canvas.getshapes();var C=[];for(var B=0;B<A.length;B++){if(A[B].id!="tracker"){C.push(Ax.dumpshape(A[B]))}}return C};Ax.dumpshapes=function(A){if(A=="json"){return Ext.util.JSON.encode(Ax.dumpshapes_core())}else{return Ax.dumpshapes_core()}};Ax.canvasWidth=480;Ax.canvasHeight=272;function $(A){return document.getElementById(A)}clockdata=function(){};Ax.onlypaths={version:"Symply Web 0.1.03 Modified"};var zoominit,centerZoomx,centerZoomy;var selectmode="";var data_path_close=false;Ax.canvasSize_core=function(){zoominit="0 0 "+Ax.canvasWidth+" "+Ax.canvasHeight;centerZoomx=Math.round(Ax.canvasWidth/2);centerZoomy=Math.round(Ax.canvasHeight/2)};Ax.canvasSize_core();Ax.canvasSize=function(){Ax.canvasSize_core();try{Ax.selectFrame(1,Ax.tcurrent.layer);Ax.reloadCanvas_core()}catch(A){}try{Ax.init_preview()}catch(A){}};Ax.drawinit_core=function(){var A=null;if(Ext.isIE==true){A=new VMLRenderer()}else{A=new SVGRenderer()}Ax.canvas=new RichDrawEditor($("drawcanvas"),A);Ax.canvas.onInputXY=Ax.setDrawXY;Ax.canvas.actualStyle=function(){};Ax.canvas.textMessaje="Ajax Animator";Ax.canvas.textSize=19;Ax.canvas.fontFamily="Arial";Ax.canvas.imageHref="http://osflash.org/_media/ajaxanimator.png?w=&h=&cache=cache";Ax.canvas.onselect=Ax.loadcolors;Ext.get(Ax.canvas.container.parentNode).on("mouseup",function(){setTimeout(function(){Ax.autodiff();return true},10)});Ax.Color.update=Ax.updatecolors;Ax.updatecolors()};Ax.drawinit=function(){$("drawcanvas").innerHTML="";$("drawcanvas").style.height=Ax.canvasHeight+"px";$("drawcanvas").style.width=Ax.canvasWidth+"px";if(Ext.isIE==true){$("drawcanvas").style.position="absolute";$("drawcanvas").style.left="5%"}Ax.drawinit_core();Ax.setTool("rect")};Ax.loadcolors=function(){Ax.setColors({lw:Ax.canvas.queryCommand("linewidth"),lc:Ax.canvas.queryCommand("linecolor").replace("#",""),fc:Ax.canvas.queryCommand("fillcolor").replace("#","")})};Ax.updatecolors=function(){Ax.canvas.editCommand("fillcolor","#"+Ax.Color.fill);Ax.canvas.editCommand("linecolor","#"+Ax.Color.line);Ax.canvas.editCommand("linewidth",Ax.Color.width.toString()+"px");Ax.canvas.setGrid(Ax.Color.grid,Ax.Color.grid);Ax.autodiff()};Ax.reloadCanvas=function(){var F=(new Date()).getTime(),B=[],A=[],E="select";try{E=Ax.canvas.queryCommand("mode")}catch(C){B.push("FO1: "+C)}try{A=Ax.dumpshapes()}catch(C){B.push("FO2: "+C);Ax.msg("Sorry","OnlyPaths has encountered a critical error. The canvas data may be unrecoverable.")}try{Ax.canvas.renderer.removeAll()}catch(C){B.push("FO3: "+C)}try{Ax.canvas.container.innerHTML=null}catch(C){B.push("FO4: "+C)}try{Ax.canvas=null}catch(C){B.push("FO5: "+C)}try{Ax.drawinit_core()}catch(C){B.push("FO6: "+C);console.log(C)}try{Ax.setTool(E)}catch(C){B.push("FO7: "+C);Ax.msg("Sorry","Recovery might have failed. You may have to restart the application.")}try{Ax.loadShapes(A)}catch(C){B.push("FO8: "+C);Ax.msg("Sorry","Recovery might have failed. You may have to restart the application.")}var D=(new Date()).getTime()-F;if(B.length>0){Ax.msg("Problems while restarting:",B.join("<br>"));Ax.msg("Attempt information","Canvas reinitialization time was "+D+"ms")}else{Ax.msg("Canvas Reloaded","This should have resolved most canvas-related issues. Canvas reinitialized in "+D+"ms")}};Ax.reloadCanvas_core=function(){try{var A=Ax.dumpshapes();Ax.canvas.renderer.removeAll();Ax.canvas.container.innerHTML=null;Ax.canvas=null;Ax.drawinit();Ax.loadShapes(A)}catch(B){return false}return true};Ax.setTool=function(A){for(var B in Ax.toolConfig){Ax.viewport.findById("tool_"+B).unselect()}if(A=="controlpath"){Ax.msg("Warning","The Polygon tool is unstable and may cause issues and possibly may corrupt the entire animation.");selectmode="controlpath"}else{if(A=="path"){selectmode=""}}try{switch(A){case"text":Ax.setPropertiesMode("Text",1);break;case"image":Ax.setPropertiesMode("Image",2);break;default:Ax.setPropertiesMode("Animation",0);break}switch(A){case"delete":Ax.canvas.deleteSelection();(function(){Ax.viewport.findById("tool_"+A).unselect();Ax.setTool("select")}).defer(200);break;case"reset":Ax.canvas.renderer.removeAll();(function(){Ax.viewport.findById("tool_"+A).unselect();Ax.setTool("select")}).defer(200);break;case"shape":Ax.canvas.unselect();(function(){Ax.viewport.findById("tool_"+A).unselect();Ax.setTool("select")}).defer(200);Ax.viewport.findById("library").expand();break;default:Ax.canvas.unselect();Ax.viewport.findById("tool_"+A).select(true);Ax.canvas.editCommand("mode",A);break}}catch(C){Ax.toastMsg("Error","OnlyPaths, the drawing component of the Ajax Animator has crashed. To attempt to fix this, go to <b>Tools->Recovery->Reload Canvas</b>.")}setTimeout(function(){Ax.autodiff();return true},10)};if(![].indexOf){Array.prototype.indexOf=function(A){for(var B=this.length;B--&&this[B]!=A;){}return B}}Ax.framerate=12;Ax.init_view=function(C,D,A){C.innerHTML="";C.style.overflow="hidden";C.style.height=(A?A:272)+"px";C.style.width=(D?D:480)+"px";Ax.canvasSize_core();var E=zoominit;zoominit="0 0 "+(D?D:480)+" "+(A?A:272);var B=Ax.init_view_core(C);zoominit=E;return B};Ax.init_view_core=function(A){if(Ext.isIE==true){var B=new VMLRenderer()}else{var B=new SVGRenderer()}return new RichDrawViewer(A,B)};Ax.viewer_load_frame=function(E,D,B,A){B.renderer.removeAll();for(var C in D){if(D[C].keyframes.indexOf(E)!=-1){Ax.loadShapes(D[C].src[E],true,B)}else{if(Ax.largest_nonempty(E,C,D)&&Ax.smallest_nonempty(E,C,D)){Ax.loadShapes(((A)?A:Ax.getSFTween)(E,Ax.largest_nonempty(E,C,D),Ax.smallest_nonempty(E,C,D),C,D[C].src),true,B)}else{if(Ax.largest_nonempty(E,C,D)){Ax.loadShapes(D[C].src[Ax.largest_nonempty(E,C,D)],true,B)}else{}}}}if(E>=Ax.count_frames(D)){return 0}return E};Ext.onReady(function(){var B=new Ext.Toolbar.TextItem("0, 0");Ax.setDrawXY=function(C,D){if(C.toString()+D.toString()=="1337"){Ext.fly(B.getEl()).update("leet")}else{Ext.fly(B.getEl()).update(C.toString()+", "+D.toString())}};var A=new Ext.Toolbar.TextItem("0");Ax.setPreviewStatus=function(C){Ext.fly(A.getEl()).update(C)};Ax.CanvasStatusbar=({defaultText:"Ready",defaultIconCls:"",items:[B,"-",{iconCls:"x-tbar-page-first",tooltip:"Go to first frame",handler:function(){Ax.controls.first()}},{iconCls:"x-tbar-page-prev",tooltip:"Go to previous frame",handler:function(){Ax.controls.previous()}},"-",'Frame <input type="text" id="cbframe" style="width: 30px" value="0"> of ?',"-",{iconCls:"x-tbar-page-next",tooltip:"Go to next frame",handler:function(){Ax.controls.next()}},{iconCls:"x-tbar-page-last",tooltip:"Go to last frame",handler:function(){Ax.controls.last()}},"-",{text:"More",menu:[{text:"Preview",handler:function(){Ax.controls.play()}}]}," "]});Ax.PreviewStatusbar=({defaultText:"Ready",defaultIconCls:"",items:[{text:"Performance: ",tooltip:"The amount of time it takes to render a frame",handler:function(){Ext.MessageBox.alert("About Performance","Lower the better, It largely depends on the framerate, speed on your computer, the number of times the animation was played, browser and the number and types of shapes.")}},A,"-",{iconCls:"x-tbar-page-first",tooltip:"Go to first frame",handler:function(){Ax.controls.first()}},{iconCls:"x-tbar-page-prev",tooltip:"Go to previous frame",handler:function(){Ax.controls.previous()}},"-",'Frame <input type="text" id="pbframe" style="width: 30px" value="0"> of ?',"-",{iconCls:"x-tbar-page-next",tooltip:"Go to next frame",handler:function(){Ax.controls.next()}},{iconCls:"x-tbar-page-last",tooltip:"Go to last frame",handler:function(){Ax.controls.last()}},"-",{text:"More",menu:[{text:"Canvas",handler:function(){Ax.viewport.findById("maintabpanel").activate(0)}}]}," "]})});Ax.setStatus=function(A){Ax.viewport.findById("canvas").getBottomToolbar().setStatus(A);Ax.viewport.findById("preview").getBottomToolbar().setStatus(A)};Ax.showBusy=function(){Ax.viewport.findById("canvas").getBottomToolbar().showBusy();Ax.viewport.findById("preview").getBottomToolbar().showBusy()};Ax.history_store=[{}];Ax.history_cursor=0;Ax.history_add=function(A){Ax.history_store.push(Ext.ux.clone(Ax.export_animation()));Ax.viewport.findById("history").getStore().add(new Ext.data.Record({id:Ax.history_store.length-1,type:(A)?A:"Edit"}));Ax.history_cursor=Ax.history_store.length-1;return Ax.history_store.length-1};Ax.history_undo=function(){Ax.history_revert(Ax.history_cursor-1)};Ax.history_redo=function(){Ax.history_revert(Ax.history_cursor+1)};Ax.history_clear=function(){Ax.history_store=[{}];var A=Ax.viewport.findById("history").getStore().getRange(1);for(var B=0;B<A.length;B++){Ax.viewport.findById("history").getStore().remove(A[B])}};Ax.history_revert=function(A){if(A<Ax.history_store.length&&A>0){Ax.history_cursor=A;Ax.import_animation(Ext.ux.clone(Ax.history_store[A]))}};Ax.History=Ext.extend(Ext.grid.GridPanel,{initComponent:function(){Ext.apply(this,{id:"history",store:new Ext.data.SimpleStore({fields:[{name:"id",type:"float"},{name:"type"}],data:[[0,"Nothing"]]}),sm:new Ext.grid.RowSelectionModel({singleSelect:true}),columns:[{id:"id",header:"#",width:20,sortable:true,dataIndex:"id"},{header:"Type",sortable:true,dataIndex:"type"}],viewConfig:{forceFit:true,autoFill:true},border:false});this.on("rowclick",function(B,A,C){B.getSelectionModel().clearSelections();if(A==0){return Ax.msg("Are You Sure?","If you really want to, the <b>File->New</b> button is there for you.")}Ax.history_revert(A)});Ax.History.superclass.initComponent.apply(this,arguments)}});Ext.reg("history",Ax.History);Ax.clipboard_store=[[]];Ax.clipboard_copy=function(){if(!Ax.canvas.selected){return Ax.msg("Error","Nothing's selected...")}Ax.clipboard_store.push(Ax.canvas.renderer.copy(Ax.canvas.selected));Ax.viewport.findById("clipboard").getStore().add(new Ext.data.Record({id:Ax.clipboard_store.length-1,type:Ax.toolConfig[Ax.clipboard_store[Ax.clipboard_store.length-1].nodeName][2]}));return Ax.clipboard_store.length-1};Ax.clipboard_cut=function(){Ax.clipboard_copy();Ax.setTool("delete")};Ax.clipboard_clear=function(){Ax.clipboard_store=[[]];var B=Ax.viewport.findById("clipboard").getStore().getRange(1);for(var A=0;A<B.length;A++){Ax.viewport.findById("clipboard").getStore().remove(B[A])}};Ax.clipboard_paste=function(A){if(!A){A=Ax.clipboard_store.length-1}Ext.get(Ax.canvas.renderer.paste(Ax.clipboard_store[A].cloneNode(true))).on("mousedown",Ax.canvas.onHit,Ax.canvas);Ax.autodiff()};Ax.Clipboard=Ext.extend(Ext.grid.GridPanel,{initComponent:function(){Ext.apply(this,{id:"clipboard",store:new Ext.data.SimpleStore({fields:[{name:"id",type:"float"},{name:"type"}],data:[[0,"Nothing"]]}),sm:new Ext.grid.RowSelectionModel({singleSelect:true}),columns:[{id:"id",header:"#",width:20,sortable:true,dataIndex:"id"},{header:"Type",sortable:true,dataIndex:"type"}],viewConfig:{forceFit:true,autoFill:true},border:false});this.on("rowclick",function(B,A,C){B.getSelectionModel().clearSelections();if(A==0){return Ax.msg("Meh.","What? You expect something to happen?")}Ax.clipboard_paste(A)});Ax.Clipboard.superclass.initComponent.apply(this,arguments)}});Ext.reg("clipboard",Ax.Clipboard);Ax.Library=Ext.extend(Ext.tree.TreePanel,{initComponent:function(){Ext.apply(this,{xtype:"treepanel",useArrows:true,autoScroll:true,animate:true,enableDD:false,containerScroll:true,root:new Ext.tree.AsyncTreeNode({text:"Shared",expanded:true,draggable:false,id:"."}),loader:new Ext.tree.TreeLoader({dataUrl:(window.location.protocol=="file:")?null:Ax.files.library}),dropConfig:{appendOnly:true},border:false});this.on("click",function(A){if(A.childrenRendered==false){Ext.Ajax.request({url:Ax.files.libraryitem+A.id,success:function(B){Ax.loadShapes(B.responseText)}})}});Ax.Library.superclass.initComponent.apply(this,arguments)}});Ext.reg("library",Ax.Library);Ax.LoginForm=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{layout:"accordion",layoutConfig:{activeOnTop:false,animate:true,autoWidth:true,collapseFirst:false,fill:true,hideCollapseTool:false,titleCollapse:true},border:false,items:[{title:"Login",layout:"fit",iconCls:"tb_login",border:false,items:[{xtype:"form",labelWidth:30,border:false,items:[{xtype:"textfield",fieldLabel:"User",name:"textvalue",width:90},{xtype:"textfield",fieldLabel:"Pass",name:"textvalue",width:90},{xtype:"button",text:"Login"}]}]},{title:"Register",layout:"fit",iconCls:"tb_register",border:false,items:[{xtype:"form",labelWidth:30,border:false,items:[{xtype:"textfield",fieldLabel:"User",name:"textvalue",width:90},{xtype:"textfield",fieldLabel:"Pass",name:"textvalue",width:90},{xtype:"textfield",fieldLabel:"Pass",name:"textvalue",width:90},{xtype:"button",text:"Create Account"}]}]}]});Ax.LoginForm.superclass.initComponent.apply(this,arguments)}});Ext.reg("loginform",Ax.LoginForm);Ax.MainToolbar=[{text:"File",menu:[{text:"New",iconCls:"tb_new",handler:function(){Ax.new_animation()}},{text:"Open",iconCls:"tb_open",menu:[{text:"From Webserver",iconCls:"tb_server",disabled:true},{text:"From Computer",iconCls:"tb_comp",handler:function(){Ax.open.file()}},{text:"From Text",iconCls:"tb_text",handler:function(){Ax.open.text()}},{text:"From URL",iconCls:"tb_url",handler:function(){Ax.open.url()}}]},{text:"Save",iconCls:"tb_save",menu:[{text:"To Webserver",iconCls:"tb_server",disabled:true},{text:"To Computer",iconCls:"tb_comp",handler:function(){Ax.save.computer()}},{text:"To Text",iconCls:"tb_text",handler:function(){Ax.save.text()}}]},"-",{text:"Publish",iconCls:"tb_publish",menu:[{text:"Flash",iconCls:"tb_flash",handler:function(){Ax.ex.swf.save()}},{text:"Processing",iconCls:"tb_processing",handler:function(){Ax.ex.processing.save()}},{text:"Silverlight",iconCls:"tb_silverlight",handler:function(){Ax.ex.silverlight.save()}},{text:"JavaFX",iconCls:"tb_javafx",handler:function(){Ax.ex.javafx.save()}},{text:"Animated GIF",iconCls:"tb_image",handler:function(){Ax.ex.gif.save()}}]},{text:"Offline",iconCls:"tb_offline",handler:function(){Ax.offline()}}]},{text:"Edit",menu:[{text:"Undo",iconCls:"tb_undo",handler:function(){Ax.history_undo()}},{text:"Redo",iconCls:"tb_redo",handler:function(){Ax.history_redo()}},"-",{text:"Cut",iconCls:"tb_cut",handler:function(){Ax.clipboard_cut()}},{text:"Copy",iconCls:"tb_copy",handler:function(){Ax.clipboard_copy()}},{text:"Paste",iconCls:"tb_paste",handler:function(){Ax.clipboard_paste()}},{text:"Delete",iconCls:"tb_delete",handler:function(){Ax.setTool("delete")}}]},{text:"View",menu:[{text:"Animation",iconCls:"tb_animation",handler:function(){Ax.controls.play()}},{text:"Information",iconCls:"tb_about",handler:function(){Ax.animationinfo()}},{text:"Theme",iconCls:"tb_theme",menu:new Ext.ux.ThemeMenu},"-",{text:"Timeline",xtype:"checkitem",checked:true,handler:function(A){Ax.timeline_setcollapse(A)}},{text:"Tools",xtype:"checkitem",checked:true,handler:function(A){Ax.tools_setcollapse(A)}},{text:"Misc",xtype:"checkitem",checked:true,handler:function(A){Ax.misc_setcollapse(A)}},{text:"Properties",xtype:"checkitem",checked:true,handler:function(A){Ax.properties_setcollapse(A)}}]},{text:"Tools",menu:[{text:"Drawing",iconCls:"tb_tools",menu:[{text:"Select",iconCls:"tx_select",handler:function(){Ax.setTool("select")}},{text:"Rectangle",iconCls:"tx_rectangle",handler:function(){Ax.setTool("rect")}},{text:"Rounded Rectangle",iconCls:"tx_roundrect",handler:function(){Ax.setTool("roundrect")}},{text:"Ellipse/Circle",iconCls:"tx_circle",handler:function(){Ax.setTool("ellipse")}},{text:"Line",iconCls:"tx_line",handler:function(){Ax.setTool("line")}},{text:"Freeform Path",iconCls:"tx_path",handler:function(){Ax.setTool("path")}},{text:"Polygon",iconCls:"tx_polygon",handler:function(){Ax.setTool("polygon")}},{text:"Text",iconCls:"tx_text",handler:function(){Ax.setTool("text")}},{text:"Image",iconCls:"tx_image",handler:function(){Ax.setTool("image")}}]},{text:"Recovery",iconCls:"tb_shield",menu:[{text:"Reload Canvas",iconCls:"tb_recover_canvas",handler:function(){Ax.reloadCanvas()}},{text:"Reload Animation",iconCls:"tb_recover_animation",handler:function(){Ax.reload_animation()}},{text:"Reload Application",iconCls:"tb_recover_application",handler:function(){window.location.reload(true)}}]},{text:"Script Executor",iconCls:"tb_script",handler:function(){Ax.macroExec()}},{text:"Plugin Settings",iconCls:"tb_plugin_conf",handler:function(){Ax.plugins_unavailable()}}]},{text:"Timeline",menu:[{text:"New Layer",iconCls:"tb_newlayer",handler:function(){Ax.addLayer()}},{text:"Insert Frame",iconCls:"tb_insertframe",handler:function(){Ax.insertFrame()}},{text:"To Keyframe",iconCls:"tb_addkeyframe",handler:function(){Ax.toKeyframe()}},{text:"Clear Frame",iconCls:"tb_clearframe",handler:function(){Ax.setTool("reset")}},"-",{text:"Reload Data",iconCls:"tb_reload",handler:function(){Ax.reloadTimeline()}},{text:"Purge Empty",iconCls:"tb_purge_empty",handler:function(){Ax.timelineCleanup()}}]},{text:"Animation",menu:[{text:"Canvas Mode",disabled:true},{text:"Play",iconCls:"tb_play",handler:function(){Ax.controls.play()}},{text:"Pause",iconCls:"tb_pause",handler:function(){Ax.controls.pause()}},{text:"Next Frame",iconCls:"tb_nf",handler:function(){Ax.controls.next()}},{text:"Previous Frame",iconCls:"tb_pf",handler:function(){Ax.controls.previous()}},{text:"Last Frame",iconCls:"tb_last",handler:function(){Ax.controls.last()}},{text:"First Frame",iconCls:"tb_first",handler:function(){Ax.controls.first()}},"-",{text:"Recalculate Tweens",iconCls:"tb_recalculate",handler:function(){}}]},{text:"Plugins",menu:[{text:"Add Plugins",iconCls:"tb_plugin_add",handler:function(){Ax.plugins_unavailable()}},"-",{text:"Explode",iconCls:"tb_plugin",handler:function(A){Ax.exec(A.initialConfig.text)}},{text:"Random Shape",iconCls:"tb_plugin",handler:function(A){Ax.exec(A.initialConfig.text)}}]},{text:"User",menu:[{text:"Login",iconCls:"tb_login",disabled:true},{text:"Logout",iconCls:"tb_logout",disabled:true},{text:"Profile",iconCls:"tb_profile",disabled:true},{text:"Browse Animations",iconCls:"tb_browse",handler:function(){Ax.showanimationbrowser()}}]},{text:"Help",menu:[{text:"About",iconCls:"tb_about",handler:function(){Ax.About()}},{text:"Key Shortcuts",iconCls:"tb_keyboard",handler:function(){Ax.keyGuide()}},{text:"Tip of the Day",iconCls:"tb_tip",handler:function(){Ax.showTips()}},{text:"Manual",iconCls:"tb_docs",handler:function(){Ax.loadManual()}},{text:"FAQ",iconCls:"tb_docs",handler:function(){Ax.loadFAQ()}},{text:"Bug Reports",iconCls:"tb_bug",handler:function(){Ax.BugReport()}},{text:"Comments",iconCls:"tb_comment",handler:function(){Ax.comment()}},{text:"Contribute",iconCls:"tb_donate",handler:function(){Ax.donate()}},{text:"Interactive Tutorials",iconCls:"tb_tutorial",menu:[{text:"Beginner's Tutorial",iconCls:"tb_info",handler:function(){Ax.tutorials_unavailable()}}]}]}];Ax.PropertiesPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{border:false,id:"properties_form",layout:"card",activeItem:0,items:[{layout:"column",defaults:{width:120},border:false,items:[{layout:"form",border:false,items:[{xtype:"numberfield",fieldLabel:"Width",name:"width",value:Ax.canvasWidth,listeners:{change:function(B,A){if(A.length==0){B.setValue(Ax.canvasWidth);A=B.getValue()}Ax.canvasWidth=A;Ax.canvasSize()}},width:60}]},{layout:"form",border:false,items:[{xtype:"numberfield",fieldLabel:"Height",name:"height",value:Ax.canvasHeight,width:60,listeners:{change:function(B,A){if(A.length==0){B.setValue(Ax.canvasHeight);A=B.getValue()}Ax.canvasHeight=A;Ax.canvasSize()}}}]},{layout:"form",border:false,items:[{xtype:"numberfield",fieldLabel:"Framerate",name:"framerate",value:Ax.framerate,width:60,listeners:{change:function(B,A){if(A.length==0){B.setValue(Ax.framerate);A=B.getValue()}Ax.framerate=A}}}]}]},{layout:"column",defaults:{width:120},border:false,items:[{layout:"form",border:false,width:300,items:[{xtype:"textfield",fieldLabel:"Text",name:"text",value:"Ajax Animator",width:240,listeners:{change:function(B,A){if(A.length==0){B.setValue("Arr! You found an easter egg! (Tada!)");A=B.getValue()}Ax.canvas.textMessaje=A}}}]},{layout:"form",border:false,items:[{xtype:"numberfield",fieldLabel:"Font Size",name:"fontsize",value:19,width:60,listeners:{change:function(B,A){if(A.length==0){B.setValue(19);A=B.getValue()}Ax.canvas.textSize=A}}}]}]},{layout:"column",defaults:{width:120},border:false,items:[{layout:"form",border:false,width:400,items:[{xtype:"textfield",fieldLabel:"URL",name:"url",value:"http://osflash.org/_media/ajaxanimator.png?w=&h=&cache=cache",width:340,listeners:{change:function(B,A){if(A.length==0){B.setValue(Ax.canvas.imageHref)}Ax.canvas.imageHref=A}}}]}]}]});Ax.PropertiesPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("properties",Ax.PropertiesPanel);Ax.setPropertiesMode=function(B,A){Ax.viewport.findById("properties").setTitle(Ax.viewport.findById("properties").title.split("-")[0]+"- "+B);Ax.viewport.findById("properties_form").layout.setActiveItem(A)};Ax.LayoutCenterPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{region:"center",layout:"fit",border:false,items:[{xtype:"tabpanel",id:"maintabpanel",tabPosition:"bottom",border:false,activeTab:0,items:[{xtype:"panel",id:"canvas_tab",title:"Canvas",iconCls:"canvas_icon",layout:"fit",tabTip:"Draw and create your animations",border:false,listeners:{activate:function(){if(Ax.viewport&&Ax.viewport.findById("toolbar")){Ax.viewport.findById("toolbar").getTopToolbar().items.item(5).menu.items.item(0).setText("Canvas Mode")}}},items:[{id:"canvas",xtype:"panel",title:"Canvas",bbar:new Ext.StatusBar(Ax.CanvasStatusbar),tools:[{id:"gear"},{id:"help",qtip:"Select tools from the west panel and draw on the canvas with them."}],iconCls:"canvas_icon",layout:"fit",tbar:[" Name: ",{xtype:"textfield",value:Ax.animation.name,listeners:{change:function(A){Ax.setAnimationName(A.getValue())}},width:200},{xtype:"tbfill"},{text:"Zoom"},{xtype:"slider",width:120,maxValue:300,value:100,increment:5,plugins:new Ext.ux.SliderTip({getText:function(A){return String.format("Canvas Zoom: {0}%",A.getValue())}})}],html:'<div class="x-border-layout-ct canvas_container"><div id="drawcanvas" class="canvas">Loading...</div></div>',border:true}]},{xtype:"panel",title:"Preview",id:"preview_tab",iconCls:"preview_icon",tabTip:"Preview and Export your animations",items:[{id:"preview",xtype:"panel",title:"Preview",tbar:[" Name: ",{xtype:"textfield",value:Ax.animation.name,listeners:{change:function(A){Ax.setAnimationName(A.getValue())}},width:200},{xtype:"tbfill"},{text:"Zoom"},{xtype:"slider",width:120,maxValue:300,value:100,increment:5,plugins:new Ext.ux.SliderTip({getText:function(A){return String.format("Canvas Zoom: {0}%",A.getValue())}})}],bbar:new Ext.StatusBar(Ax.PreviewStatusbar),border:false,tools:[{id:"gear"},{id:"help",qtip:"Preview and Export your animations to Flash&reg; ... Hopefully"}],iconCls:"preview_icon",layout:"fit",html:'<div class="x-border-layout-ct canvas_container"><div class="canvas" id="previewcanvas">Loading...</div></div>'}],listeners:{render:function(){setTimeout(function(){Ax.setAnimationName(Ax.animation.name)},100)},activate:function(){Ax.viewport.findById("toolbar").getTopToolbar().items.item(5).menu.items.item(0).setText("Preview Mode");Ax.init_preview();clearTimeout(Ax.preview_timeout);Ax.preview_increment()},deactivate:function(){Ax.controls.pause()}},layout:"fit",border:true},{iconCls:"animations_icon",xtype:"animationbrowser",tabTip:"Share and View other user's animations",listeners:{activate:function(){},deactivate:function(){Ax.player_pause()}}}]}]});Ax.LayoutCenterPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("layoutcenter",Ax.LayoutCenterPanel);Ax.setAnimationName=function(A){if(!A||A.replace(/ /g,"")==""){A="Untitled Production"}Ax.animation.name=A;if(Ax.viewport.findById("canvas").getTopToolbar().items){Ax.viewport.findById("canvas").getTopToolbar().items.item(1).getEl().value=A}if(Ax.viewport.findById("preview").getTopToolbar().items){Ax.viewport.findById("preview").getTopToolbar().items.item(1).getEl().value=A}};Ax.LayoutEastPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{region:"east",title:"Misc",id:"misc",iconCls:"misc_panel_icon",split:true,collapsible:true,titleCollapse:true,width:130,layout:"fit",border:true,items:[{xtype:"tabpanel",activeTab:0,border:false,items:[{xtype:"panel",title:"Misc",iconCls:"misc_icon",layout:"fit",items:[{layout:"accordion",autoScroll:true,layoutConfig:{activeOnTop:false,animate:true,autoWidth:true,collapseFirst:false,fill:true,hideCollapseTool:false,titleCollapse:true},border:false,items:[{title:"History",autoHeight:true,xtype:"history",iconCls:"history_icon",border:false,tools:[{id:"close",qtip:"Clear History",handler:function(){Ax.history_clear()}}]},{title:"Clipboard",autoHeight:true,xtype:"clipboard",layout:"fit",iconCls:"clipboard_icon",tools:[{id:"close",qtip:"Clear Clipboard",handler:function(){Ax.clipboard_clear()}}],border:false},{title:"Library",id:"library",autoHeight:true,iconCls:"library_icon",border:false,items:[{xtype:"library"}]},{title:"Misc",autoHeight:true,iconCls:"misc_icon",html:"Unavailable",border:false}]}]},{disabled:true,xtype:"panel",title:"User",iconCls:"user_icon",layout:"fit",border:false,items:[{xtype:"loginform"}]}]}]});this.initialConfig.collapsible=true;Ax.LayoutEastPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("layouteast",Ax.LayoutEastPanel);Ax.misc_setcollapse=function(A){if(Ax.viewport.findById("misc").collapsed!=A.checked){Ax.viewport.findById("misc").toggleCollapse()}};Ax.LayoutWestPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{region:"west",title:"Tools",id:"tools",split:true,collapsible:true,titleCollapse:true,hideCollapseTool:true,width:50,border:true,items:[{xtype:"toolbox"},{xtype:"drawpanel"}]});this.initialConfig.collapsible=true;Ax.LayoutWestPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("layoutwest",Ax.LayoutWestPanel);Ax.tools_setcollapse=function(A){if(Ax.viewport.findById("tools").collapsed!=A.checked){Ax.viewport.findById("tools").toggleCollapse()}};Ax.LayoutNorthPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{region:"north",layout:"fit",collapsible:true,collapseMode:"mini",split:true,border:false,id:"timeline",height:70,items:{xtype:"timeline",border:false}});this.initialConfig.collapsible=true;Ax.LayoutNorthPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("layoutnorth",Ax.LayoutNorthPanel);Ax.LayoutSouthPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{region:"south",id:"properties",iconCls:"app_settings",title:"Properties - Animation",split:true,collapsible:true,titleCollapse:true,height:50,items:[{xtype:"form",labelWidth:50,border:false,items:{xtype:"properties"}}]});this.initialConfig.collapsible=true;Ax.LayoutSouthPanel.superclass.initComponent.apply(this,arguments)}});Ext.reg("layoutsouth",Ax.LayoutSouthPanel);Ax.properties_setcollapse=function(A){if(Ax.viewport.findById("properties").collapsed!=A.checked){Ax.viewport.findById("properties").toggleCollapse()}};Ax.RegistrationForm=Ext.extend(Ext.form.FormPanel,{initComponent:function(){Ext.apply(this,{xtype:"form",title:"Registration Form",border:false,items:[{xtype:"textfield",fieldLabel:"Username",name:"textvalue"},{xtype:"textfield",fieldLabel:"Password",name:"textvalue",inputType:"password"},{xtype:"textfield",fieldLabel:"Password",name:"textvalue",inputType:"password"},{xtype:"button",text:"Register Account"}]});Ax.RegistrationForm.superclass.initComponent.apply(this,arguments)}});Ext.reg("registrationform",Ax.RegistrationForm);Ext.onReady(function(){Ax.viewport=new Ext.Viewport({layout:"border",border:false,window:{layout:"fit"},items:[{region:"north",id:"toolbar",border:false,tbar:Ax.MainToolbar,height:27},{region:"center",layout:"border",border:false,items:[{xtype:"layoutcenter"},{xtype:"layoutnorth"},{xtype:"layoutsouth"},{xtype:"layoutwest"},{xtype:"layouteast"}]}]})});Ax.largest_nonempty=function(E,C,A){var D=[];A=(A)?A:Ax.layers;for(var B=0;B<A[C].keyframes.length;B++){if(parseInt(A[C].keyframes[B])<E){D.push(parseInt(A[C].keyframes[B]))}}return D.sort(function(G,F){return F-G})[0]};Ax.smallest_nonempty=function(E,C,A){var D=[];A=(A)?A:Ax.layers;for(var B=0;B<A[C].keyframes.length;B++){if(parseInt(A[C].keyframes[B])>E){D.push(parseInt(A[C].keyframes[B]))}}return D.sort(function(G,F){return G-F})[0]};Ax.count_frames=function(C,A){A=(A)?A:0;C=(C)?C:Ax.layers;for(var B in C){var D=C[B].keyframes.sort(function(F,E){return E-F})[0];if(D>A){A=D}}return A};Ax.getSFTween_core=function(A,F,D,G,K,J){var E={},I={},L={},M={},C=[];for(var B=0;B<K[F].length;B++){E[K[F][B].id]=K[F][B];L[K[F][B].id]=null}for(var B=0;B<K[D].length;B++){I[K[D][B].id]=K[D][B];L[K[D][B].id]=null}M=Ext.ux.clone(I);for(var B in L){if(I[B]&&E[B]){for(var H in I[B]){M[B][H]=Ax.tweenAttribute(H,F,D,E[B][H],I[B][H],A)}}}for(var B in M){C.push(M[B])}return C};Ax.tweenAttribute=function(D,F,E,B,A,C){if(B==A){return B}if(typeof A=="number"){return Math.round(Ax.tweenNumber(F,E,B,A,C)*1000)/1000}if(D=="transform"){return Ax.tweenTransform(F,E,B,A,C)}if(D=="points"){return Ax.tweenPath(F,E,B,A,C)}if(B.substr(0,1)=="#"&&A.substr(0,1)=="#"){return Ax.tweenHex(F,E,B,A,C)}return A};Ax.tweenTransform=function(H,G,D,B,E){D=Ax.parseTransform(D);B=Ax.parseTransform(B);var F=Ax.tweenNumber(H,G,D[0],B[0],E),C=Ax.tweenNumber(H,G,D[1],B[1],E),A=Ax.tweenNumber(H,G,D[2],B[2],E);if(isNaN(F)==true){F=0}if(isNaN(C)==true){C=0}if(isNaN(A)==true){A=0}return"rotate("+[F,C,A].join(", ")+")"};Ax.parseTransform=function(A){if(!A||typeof A!="string"){return[0,0,0]}A=A.replace(")","").replace("rotate(","").split(",");return[Math.round(parseFloat(A[0])*1000)/1000,Math.round(parseFloat(A[1])*1000)/1000,Math.round(parseFloat(A[2])*1000)/1000]};Ax.tweenPath=function(F,E,B,A,C){B=Ax.parsePath(B);A=Ax.parsePath(A);for(var D=0;D<A.length;D++){if(parseFloat(A[D]).toString()==A[D]){A[D]=Ax.tweenNumber(F,E,parseFloat(B[D]),parseFloat(A[D]),C)}}return A.join(" ")};Ax.parsePath=function(A){A=A.replace(/,/g," , ");A=A.replace(/L/g," L ");A=A.replace(/M/g," M ");A=A.replace(/  /g," ");A=A.replace(/  /g," ");return A.split(" ")};Ax.tweenHex=function(E,D,B,A,C){B=Ax.hex2rgb(B);A=Ax.hex2rgb(A);return"#"+[Ax.toHex(Ax.tweenNumber(E,D,parseInt(B.R),parseInt(A.R),C)),Ax.toHex(Ax.tweenNumber(E,D,parseInt(B.G),parseInt(A.G),C)),Ax.toHex(Ax.tweenNumber(E,D,parseInt(B.B),parseInt(A.B),C))].join("")};Ax.hex2rgb=function(B){var A=B.toLowerCase().match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/);if(A){return{R:parseInt(A[1],16),G:parseInt(A[2],16),B:parseInt(A[3],16)}}else{return{R:0,G:0,B:0}}};Ax.toHex=function(A){A=parseInt(Math.floor(A)).toString(16);return(A.length<2)?"0"+A:A};Ax.tweenNumber=function(E,D,B,A,C){return B+((C-E)/(D-E))*(A-B)};Ax.tween=function(D,C,B){if(D&&C){for(var A=D+1;A<C;A++){Ax.toTween(A,B)}}};Ax.getSFTween=function(E,D,C,B,A){if(!E){E=Ax.tcurrent.frame}if(!B){B=Ax.tcurrent.layer}if(!D){D=Ax.largest_nonempty(E,B)}if(!C){C=Ax.smallest_nonempty(E,B)}A=(A)?A:Ax.canvas_storage[B];if(!A[D]){Ax.toastMsg("Error!","Ajax Animator's Tweening Engine has encountered a potentially critical error because store[frame1] is non-existant.");A[D]=[]}if(!A[C]){Ax.toastMsg("Error!","Ajax Animator's Tweening Engine has encountered a potentially critical error because store[frame2] is non-existant.");A[C]=[]}return Ax.getSFTween_core(E,D,C,B,A)};Ax.controls={play:function(){Ax.viewport.findById("maintabpanel").activate(1);Ax.preview_increment()},pause:function(){Ax.viewport.findById("maintabpanel").activate(1);clearTimeout(Ax.preview_timeout);clearTimeout(Ax.preview_timeout);clearTimeout(Ax.preview_timeout)},next:function(){switch(Ax.viewport.findById("maintabpanel").getActiveTab().getId()){case"canvas_tab":Ax.selectFrame(Ax.tcurrent.frame+1,Ax.tcurrent.layer);break;case"preview_tab":Ax.preview_frame++;break}},previous:function(){switch(Ax.viewport.findById("maintabpanel").getActiveTab().getId()){case"canvas_tab":Ax.selectFrame(Ax.tcurrent.frame-1,Ax.tcurrent.layer);break;case"preview_tab":Ax.preview_frame--;break}},last:function(){switch(Ax.viewport.findById("maintabpanel").getActiveTab().getId()){case"canvas_tab":Ax.selectFrame(Ax.count_frames(),Ax.tcurrent.layer);break;case"preview_tab":Ax.preview_frame=Ax.count_frames();break}},first:function(){switch(Ax.viewport.findById("maintabpanel").getActiveTab().getId()){case"canvas_tab":Ax.selectFrame(1,Ax.tcurrent.layer);break;case"preview_tab":Ax.preview_frame=1;break}}};Ax.dumpframe=function(C,B){if(!C){C=Ax.tcurrent.frame}if(!B){B=Ax.tcurrent.layer}if(!Ax.canvas_storage[B]){Ax.canvas_storage[B]={}}var A=Ax.dumpshapes();if(!Ax.isTween(C,B)){Ax.canvas_storage[B][C]=A}return A};Ax.loadframe=function(B,A){if(Ax.canvas_storage[A][B]){Ax.canvas.unselect();Ax.canvas.renderer.removeAll();Ax.loadShapes(Ax.canvas_storage[A][B]);Ax.autodiff();return true}else{if(Ax.isTween(B,A)){Ax.canvas.unselect();Ax.canvas.renderer.removeAll();Ax.loadShapes(Ax.getSFTween(B,Ax.largest_nonempty(B,A),Ax.smallest_nonempty(B,A),A));return true}}Ax.canvas.renderer.removeAll();Ax.loadShapes(Ax.canvas_storage[A][Ax.largest_nonempty(B,A)]);Ax.canvas.unselect();return false};Ax.diff_exclude=["id"];Ax.autodiff=function(){if(Ax.tcurrent.layer&&Ax.tcurrent.frame){var A=false;if(Ax.canvas_storage[Ax.tcurrent.layer]&&Ax.canvas_storage[Ax.tcurrent.layer][Ax.tcurrent.frame]&&Ax.diff_core(Ax.dumpshapes(),Ax.canvas_storage[Ax.tcurrent.layer][Ax.tcurrent.frame])!=true){A=true}Ax.dumpframe();if(Ax.isTween()==true&&Ax.diff_core(Ax.dumpshapes(),Ax.getSFTween())!=true){Ax.toKeyframe(Ax.tcurrent.frame,Ax.tcurrent.layer)}else{if(Ax.diff(Ax.largest_nonempty(Ax.tcurrent.frame,Ax.tcurrent.layer),Ax.tcurrent.frame,Ax.tcurrent.layer)!=true&&Ax.layers[Ax.tcurrent.layer].tweens.indexOf(Ax.tcurrent.frame)==-1){Ax.toKeyframe(Ax.tcurrent.frame,Ax.tcurrent.layer)}else{if(Ax.isKeyframe()==false){delete Ax.canvas_storage[Ax.tcurrent.layer][Ax.tcurrent.frame]}}}if(A==true){if(Ax.canvas&&Ax.canvas.queryCommand("mode")){Ax.history_add(Ax.toolConfig[Ax.canvas.queryCommand("mode")][2])}}}};Ax.diff=function(C,B,A){return Ax.diff_core(Ax.canvas_storage[A][C],Ax.canvas_storage[A][B])};Ax.diff_core=function(D,B){if((!D||!B)||(D.length!=B.length)){return false}else{for(var C=0;C<D.length;C++){for(var A in B[C]){if(Ax.diff_attr(D[C][A],B[C][A],A)==false){return false}}}}return true};Ax.diff_list=function(D,B){var E=[];if((!D||!B)||(D.length!=B.length)){return false}else{for(var C=0;C<D.length;C++){for(var A in B[C]){if(Ax.diff_attr(D[C][A],B[C][A],A)==false){E.push([D[C],A])}}}}return E};Ax.diff_attr=function(B,A,C){if(Ax.diff_exclude.indexOf(C)==-1){if(typeof A=="number"){A=Math.round(A*100)/100;B=Math.round(B*100)/100}if(C=="transform"){if(Math.round(Ax.parseTransform(A)[0])!=Math.round(Ax.parseTransform(B)[0])){return false}}else{if(A!=B){return false}}}return true};Ax.AnimationBrowser=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{id:"Animations",xtype:"panel",title:"Animations",border:false,layout:"fit",items:{layout:"border",border:false,items:[{region:"center",title:"Player",id:"Player",layout:"border",items:[{region:"north",border:false,tbar:[{text:"By:&nbsp;Unavailable"},{xtype:"tbfill"},"Unavailable"],height:27},{region:"south",border:false,bbar:[{text:"Play",iconCls:"play_icon",handler:function(){Ax.player_play()}},{text:"Pause",iconCls:"stop_icon",handler:function(){Ax.player_pause()}},{text:"Import to Editor",iconCls:"import_icon",handler:function(){Ax.player_import()}},{xtype:"tbfill"},"?/? ?FPS"],height:27},{region:"center",border:false,html:'<div class="x-border-layout-ct canvas_container"><div id="playercanvas" class="canvas"></div></div>'}],autoScroll:true,tools:[{id:"gear"},{id:"help",qtip:'View and share animations with other users. Use the left panel to browse for animations, and click them to view them. Feel free to press the "import" button and make improvements.'}],iconCls:"player_icon"},{region:"west",id:"treebrowse",title:"Browse",collapseFirst:false,tools:[{id:"plus",qtip:"Expand All",handler:function(){Ax.viewport.findById("treebrowse").expandAll()}},{id:"minus",qtip:"Collapse All",handler:function(){Ax.viewport.findById("treebrowse").collapseAll()}}],iconCls:"browse_icon",width:200,split:true,collapsible:true,layout:"fit",titleCollapse:true,xtype:"treepanel",useArrows:true,autoScroll:true,animate:true,enableDD:false,containerScroll:true,bbar:[{text:"Reload",qtip:"Reload Tree Data",iconCls:"reload_icon",handler:function(){Ax.viewport.findById("treebrowse").getLoader().load(Ax.viewport.findById("treebrowse").getRootNode())}}],root:new Ext.tree.AsyncTreeNode({text:"Animations",expanded:true,draggable:false,id:"."}),loader:new Ext.tree.TreeLoader({dataUrl:(window.location.protocol=="file:")?null:Ax.files.userlist}),listeners:{click:function(A){if(A.childrenRendered==false){Ext.Ajax.request({url:Ax.files.animations+A.id,success:function(B){Ax.player_pause();Ax.init_player(B.responseText);Ax.player_play()}})}}}}]}});Ax.AnimationBrowser.superclass.initComponent.apply(this,arguments)}});Ext.reg("animationbrowser",Ax.AnimationBrowser);Ax.showanimationbrowser=function(){Ax.viewport.findById("maintabpanel").activate(2)};Ax.canvas_storage={};Ax.getshapes=function(B,A){if(!B){B=Ax.tcurrent.frame}if(!A){A=Ax.tcurrent.layer}if(!Ax.canvas_storage[A]){return[]}if(Ax.canvas_storage[A][B]){return(Ax.canvas_storage[A][B])}else{if(Ax.smallest_nonempty(B,A)&&Ax.largest_nonempty(B,A)){return Ax.getSFTween(B,Ax.largest_nonempty(B,A),Ax.smallest_nonempty(B,A),A)}}return[]};Ax.Timeline=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{layout:"border",items:[{region:"center",autoScroll:true,border:false,html:"<div id='timeline_core' class='x-unselectable' style='height: 100%; width: 100%'>Loading Frames...</div>"},{region:"west",width:100,border:false,split:true,collapsible:true,collapseMode:"mini",autoScroll:true,layout:"fit",items:{id:"layers",xtype:"editorgrid",border:false,hideHeaders:true,plugins:[new Ext.ux.grid.CellActions({callbacks:{tb_delete:function(B,A,D,C){if(Ax.tcurrent.layer==C){return Ax.toastMsg("Error!","You can't delete the current selected layer!")}Ext.MessageBox.confirm("Delete "+C+"?","Are you sure you want to delete "+C+"?",function(E){if(E=="yes"){Ax.deleteLayer(C)}})}}})],viewConfig:{autoFill:true,forceFit:true},listeners:{afteredit:function(A){Ax.renameLayer(A.originalValue,A.value)}},sm:new Ext.grid.RowSelectionModel({singleSelect:true}),ds:new Ext.data.Store(),columns:[{header:"Comment",dataIndex:"comment",editor:new Ext.form.TextField(),cellActions:[{iconCls:"tb_delete",qtip:"Delete this layer."}]}]}}]});Ax.Timeline.superclass.initComponent.apply(this,arguments)}});Ext.reg("timeline",Ax.Timeline);Ax.timeline_setcollapse=function(A){if(Ax.viewport.findById("timeline").collapsed!=A.checked){Ax.viewport.findById("timeline").toggleCollapse()}};Ax.timeline={el:null,mask:null};Ax.layers={};Ax.tstat={layers:0,frames:0};Ax.tcurrent={layer:null,frame:null};Ax.renameLayer=function(B,A){Ax.layers[A]=Ax.layers[B];delete Ax.layers[B];Ax.canvas_storage[A]=Ax.canvas_storage[B];delete Ax.canvas_storage[B];return Ax.layers};Ax.deleteLayer=function(A){if(Ax.tcurrent.layer==A){return Ax.toastMsg("Delete Error","You can not delect the current selected layer.")}Ext.get(Ax.layers[A].el).remove();Ax.viewport.findById("layers").getStore().remove(Ax.layers[A].record);delete Ax.layers[A];Ax.tstat.layers--};Ax.addLayer=function(B){B=(B)?B:"Layer "+((Ax.tstat.layers+1).toString());var A=document.createElement("tr");Ax.layers[B]={el:A,keyframes:[1],tweens:[],record:new Ext.data.Record({comment:B})};Ax.viewport.findById("layers").getStore().add(Ax.layers[B].record);if(!Ax.canvas_storage[B]){Ax.canvas_storage[B]={"1":[]}}Ax.tstat.layers++;Ax.timeline.el.appendChild(A);for(var C=0;C<Ax.tstat.frames;C++){Ax.addFrame_core(C+1,B)}return A};Ax.addFrame=function(){Ax.tstat.frames++;for(var A in Ax.layers){Ax.addFrame_core(Ax.tstat.frames,A)}};Ax.addFrames=function(B){for(var A=0;A<B;A++){Ax.addFrame()}};Ax.addFrame_core=function(C,A){var D=document.createElement("td");D.className="frame";var B=document.createElement("div");B.className="frame";B.innerHTML=C;switch(B.innerHTML.length){case 1:B.style.marginTop="1px";B.style.fontSize="110%";break;case 2:B.style.marginBottom="-2px";B.style.fontSize="90%";break;case 3:B.style.marginBottom="-7px";B.style.fontSize="65%";break;case 4:B.style.marginBottom="-11px";B.style.fontSize="40%";break}D.appendChild(B);Ax.addFrameListeners(D,C,A);Ax.layers[A].el.appendChild(D)};Ax.getFrame=function(B,A){if(B>0){return Ext.get(Ax.layers[A].el.childNodes[B-1])}};Ax.selectFrame=function(B,A){if(B<1){return false}if(Ext.get("cbframe")){Ext.get("cbframe").dom.value=B}Ax.viewport.findById("layers").getSelectionModel().selectRecords([Ax.layers[A].record],false);Ax.autodiff();Ax.tcurrent.frame=B;Ax.tcurrent.layer=A;Ax.selectFrame_core(B,A);if(B>Ax.tstat.frames-30){Ax.addFrames(50-(Ax.tstat.frames-B))}Ax.loadframe(B,A)};Ax.selectFrame_core=function(B,A){Ax.timeline.mask.style.top=(Ax.getFrame(B,A).getY()-Ext.get(Ax.timeline.el).getY()).toString()+"px";Ax.timeline.mask.style.left=(Ax.getFrame(B,A).getX()-Ext.get(Ax.timeline.el).getX()).toString()+"px"};Ax.insertFrame=function(D,B){if(D<1){return false}if(!D){D=Ax.tcurrent.frame}if(!B){B=Ax.tcurrent.layer}Ax.addFrame();for(var A=0;A<Ax.layers[B].keyframes.length;A++){if(Ax.layers[B].keyframes[A]>D){var C=Ax.layers[B].keyframes[A];Ax.layers[B].keyframes[A]+=1;Ax.canvas_storage[B][(C+1).toString()]=Ax.canvas_storage[B][C.toString()];delete Ax.canvas_storage[B][C.toString()]}}for(var A=0;A<Ax.layers[B].tweens.length;A++){if(Ax.layers[B].tweens[A]>D){Ax.layers[B].tweens[A]+=1}}for(var A=D;A<Ax.tstat.frames;A++){Ax.renderFrame(A,B)}if(Ax.isTween(D,B)){Ax.tween(Ax.largest_nonempty(D,B),Ax.smallest_nonempty(D,B),B);if(D==Ax.tcurrent.frame&&B==Ax.tcurrent.layer){Ax.loadframe(D,B)}}};Ax.renderFrame=function(B,A){switch(Ax.frameType(B,A)){case"keyframe":Ax.toKeyframe_core(B,A);break;case"tween":Ax.toTween_core(B,A);break;case"blank":Ax.toBlank_core(B,A);break}};Ax.frameType=function(B,A){if(Ax.isKeyframe(B,A)==true){return"keyframe"}if(Ax.isTween(B,A)==true){return"tween"}return"blank"};Ax.toKeyframe=function(B,A){if(!B){B=Ax.tcurrent.frame}if(!A){A=Ax.tcurrent.layer}if(!Ax.isKeyframe(B,A)){Ax.layers[A].keyframes.push(B)}if(Ax.isTween(B,A)){Ax.layers[A].tweens.splice(Ax.layers[A].tweens.indexOf(B),1)}else{Ax.tween(Ax.largest_nonempty(B,A),B,A)}return Ax.toKeyframe_core(B,A)};Ax.frameClass=function(C,A,B){Ax.getFrame(C,A).dom.className="frame "+B};Ax.isTween=function(B,A){if(!B){B=Ax.tcurrent.frame}if(!A){A=Ax.tcurrent.layer}return(Ax.layers[A].tweens.indexOf(B)!=-1)};Ax.isKeyframe=function(B,A){if(!B){B=Ax.tcurrent.frame}if(!A){A=Ax.tcurrent.layer}return(Ax.layers[A].keyframes.indexOf(B)!=-1)};Ax.toKeyframe_core=function(B,A){Ax.frameClass(B,A,"keyframe")};Ax.toTween_core=function(B,A){Ax.frameClass(B,A,"tween")};Ax.toTween=function(B,A){if(Ax.layers[A].tweens.indexOf(B)==-1){Ax.layers[A].tweens.push(B)}return Ax.toTween_core(B,A)};Ax.toBlank_core=function(B,A){Ax.frameClass(B,A)};Ax.addFrameListeners=function(C,B,A){new Ext.ToolTip({target:C,trackMouse:true,shadow:false,width:120,title:"Loading...",html:"Loading...",rframe:B,rlayer:A,listeners:{show:function(H){var D={Shapes:Ax.getshapes(H.rframe,H.rlayer).length},F="";for(var E in D){F+='<span style="float: left">'+E+'</span><span style="float: right">'+D[E]+"</span><br>"}var G=document.createElement("div");G.className="preview_tip";Ext.get(G).setHeight(((H.getBox().width-12)*Ax.canvasHeight)/Ax.canvasWidth);Ext.get(G).setWidth(H.getBox().width-12);H.setTitle("Frame "+H.rframe.toString()+" "+H.rlayer.toString());H.body.update(F);if(Ext.isIE){G.innerHTML="Preview Tips Not Available For Microsoft Internet Explorer"}H.body.dom.appendChild(G);Ax.viewer_load_frame(H.rframe,Ax.export_animation_core(),Ax.init_view_core(G))},hide:function(D){D.body.dom.innerHTML=""}}})};Ax.create_timeline_mask=function(){Ax.timeline.mask=document.createElement("div");Ax.timeline.mask.className="fselect_mask";Ax.timeline.el.appendChild(Ax.timeline.mask);new Ext.ToolTip({target:Ax.timeline.mask,trackMouse:true,shadow:false,title:"Loading...",html:"Loading...",listeners:{show:function(A){A.setTitle("Frame "+Ax.tcurrent.frame.toString()+" "+Ax.tcurrent.layer.toString());A.body.update("Selected Frame")}}})};Ax.reloadTimeline=function(){for(var A in Ax.layers){for(var B=1;B<Ax.tstat.frames+1;B++){Ax.renderFrame(B,A)}}Ax.msg("Timeline Reloaded","Timeline has been sucessfully rendered")};Ax.timelineCleanup=function(){Ax.msg("Timeline Cleanup","Timeline has been sucessfully cleaned up.")};Ax.initTimeline=function(){Ax.layers={};Ext.get("timeline_core").dom.innerHTML="";var A=document.createElement("table");A.setAttribute("cellspacing","0");A.setAttribute("cellpadding","0");A.setAttribute("border","0");var B=document.createElement("tbody");A.appendChild(B);Ext.get("timeline_core").dom.appendChild(A);Ax.timeline.el=B;Ext.get("timeline_core").parent().on("selectstart",function(C){C.stopEvent();return false});Ext.get("timeline_core").parent().on("mousedown",function(D,E){if(E.className=="frame"){for(var C in Ax.layers){if(E.parentNode.parentNode==Ax.layers[C].el){Ax.selectFrame(parseInt(E.innerHTML),C);break}}}if(D.button==2){}});Ext.get("timeline_core").parent().on("contextmenu",function(C,D){C.stopEvent();if(D.className=="fselect_mask"||(D.innerHTML==Ax.tcurrent.frame.toString())){new Ext.menu.Menu({items:[{text:"Add Layer",iconCls:"tb_newlayer",handler:function(){Ax.addLayer()}},{text:"To Keyframe",iconCls:"tb_addkeyframe",handler:function(){Ax.toKeyframe()}},{text:"Insert Frame",iconCls:"tb_insertframe",handler:function(){Ax.insertFrame()}}]}).showAt(C.xy)}else{new Ext.menu.Menu({items:[{text:"Add Layer",iconCls:"tb_newlayer",handler:function(){Ax.addLayer()}}]}).showAt(C.xy)}});Ax.create_timeline_mask()};Ax.preview_increment=function(){var A=(new Date()).getTime();Ax.preview_frame=Ax.viewer_load_frame(((Ax.preview_frame)?Ax.preview_frame:Ax.tcurrent.frame),Ax.preview_markup,Ax.preview)+1;if(Ax.preview_frame%4==0){Ext.get("pbframe").dom.value=Ax.preview_frame;Ax.setPreviewStatus(Math.round((new Date()).getTime()-A))}Ax.preview_timeout=setTimeout(function(){Ax.preview_increment()},1000/Ax.framerate)};Ax.preview_msg=function(){Ax.msg("Preview","Preview is for viewing! Head over to the Canvas tab to edit.")};Ax.init_preview=function(){Ax.autodiff();$("previewcanvas").innerHTML="";Ext.get("previewcanvas").un("mousedown",Ax.preview_msg);Ax.preview=Ax.init_view($("previewcanvas"),Ax.canvasWidth,Ax.canvasHeight);Ext.get("previewcanvas").on("mousedown",Ax.preview_msg);Ax.preview_markup=Ax.export_animation_core();Ax.preview_frame=null};Ax.player_increment=function(){var A=(new Date()).getTime();Ax.player_frame=Ax.viewer_load_frame(((Ax.player_frame)?Ax.player_frame:1),Ax.player_markup.layers,Ax.player)+1;Ax.player_timeout=setTimeout(function(){Ax.player_increment()},1000/((Ax.player_markup.framerate)?Ax.player_markup.framerate:12))};Ax.player_play=function(){Ax.player_increment()};Ax.player_pause=function(){clearTimeout(Ax.player_timeout)};Ax.init_player=function(A){if(Ext.isIE==true){$("playercanvas").style.position="absolute";$("playercanvas").style.left="5%"}if(typeof A==typeof "insanelygreat"){A=Ext.util.JSON.decode(A)}$("playercanvas").innerHTML="";Ax.player=Ax.init_view($("playercanvas"),A.width,A.height);Ax.player_markup=A;Ax.player_frame=null};Ax.player_import=function(){Ax.viewport.findById("maintabpanel").activate(0);Ax.import_animation(Ax.player_markup)};Ax.format={support:{min:1,max:13},revision:13};Ax.emptyAnimation={layers:{"Layer 1":{keyframes:[1],src:{"1":[]}}}};Ax.new_animation=function(){Ax.import_animation(Ext.ux.clone(Ax.emptyAnimation));Ax.history_add("New Animation")};Ax.export_animation_core=function(A,D){var C={};for(var B in Ax.layers){C[B]={keyframes:Ax.layers[B].keyframes,src:Ax.canvas_storage[B]}}return C};Ax.export_animation=function(A,B){if(!A){A={}}A.name=Ax.animation.name;if(!A.creation){A.creation=(new Date()).getTime()}if(typeof A.contrib!=typeof ["antimatter15","is","awesome"]){A.contrib=[]}if(A.contrib.indexOf((Ax.userid)?Ax.userid:"anonymous")==-1){A.contrib.push((Ax.userid)?Ax.userid:"anonymous")}A.modified=(new Date()).getTime();A.generator=Ax.v;A.revision=Ax.format.revision;A.tcframe=Ax.tcurrent.frame;A.tclayer=Ax.tcurrent.layer;A.layers=Ax.export_animation_core();A.width=Ax.canvasWidth;A.height=Ax.canvasHeight;A.framerate=Ax.framerate;if(B=="json"){return Ext.util.JSON.encode(A)}else{return A}};Ax.import_animation=function(A){if(typeof A==typeof "tehkooliest"){A=Ext.util.JSON.decode(A)}Ax.setAnimationName(A.name);Ax.animation.markup=A;Ax.canvasWidth=A.width?A.width:480;Ax.canvasHeight=A.height?A.height:272;Ax.canvasSize_core();Ax.framerate=A.framerate?A.framerate:12;Ax.import_animation_core(A.layers);Ax.selectFrame((A.tcframe)?A.tcframe:1,(A.tclayer)?A.tclayer:"Layer 1")};Ax.test_animation_markup=function(A){if(typeof A!=typeof "actionwoot"){return false}try{A=Ext.util.JSON.decode(A)}catch(B){return false}if(!A){return false}if(typeof A!=typeof ({woot:"ness"})){return false}if(typeof A.layers!=typeof ({ello:"world"})){return false}return A};Ax.import_animation_core=function(D){Ax.reloadCanvas_core();Ax.viewport.findById("layers").getStore().removeAll();Ax.initTimeline();Ax.canvas_storage={};Ax.canvas.unselect();Ax.canvas.renderer.removeAll();Ax.layers={};Ax.tstat.layers=0;for(var C in D){Ax.tcurrent.layer=C;Ax.tcurrent.frame=1;Ax.loadShapes(D[C].src[1]);break}for(var B in D){Ax.addLayer(B);Ax.layers[B].keyframes=D[B].keyframes;Ax.canvas_storage[B]=D[B].src;for(var A=0;A<D[B].keyframes.sort(function(F,E){return E-F})[0]+1;A++){Ax.selectFrame(A+1,B);if(D[B].keyframes.indexOf(A+1)!=-1){Ax.toKeyframe(A+1,B)}}}};Ax.reload_animation=function(){try{Ax.import_animation(Ax.export_animation(Ax.animation.markup))}catch(A){return Ax.msg("Animation Recovery","Animation recovery has failed due to error: "+A)}Ax.msg("Animation Reloaded","The current animation was reloaded. This hopefully has resolved most issues related to the timeline and other components.")};Ax.autoimport=function(A){var B=Ax.test_animation_markup(A);if(B!=false){if(B.revision){if(Math.round(B.revision)>Ax.format.support.max){Ax.msg("Warning! Proof of time travel","It seems that the animation you are attempting to load was created with a future version of the ajax animator. It may contain data that can not be loaded properly in this version, or may load perfectly fine.")}if(Math.round(B.revision)<Ax.format.support.min){Ax.msg("Warning!","The animation you are attempting to load seems to be created by an older, unsupported version. It is more than likely some information here will not load properly.")}}Ax.import_animation(A)}else{if(A.indexOf(";;")!=-1){Ax.msg("Unable to load animation!","The animation looks like data from the AXML format used by Ajax Animator 0.14.7 and below. It is not supported natively in this release due to the usage of a new format in 0.20+.")}else{Ax.msg("Unable to load animation!","The animation could not be loaded because it is malformed. Check the data for corruption, or from an unsupported source.")}}};Ax.animationinfo=function(A){if(A=="core"){return"<b>"+Ax.animation.name+":</b><br />Generator: "+(Ax.animation.markup.generator?(Ax.animation.markup.generator.app+" build "+Ax.animation.markup.generator.build):"Unknown")+"<br />Format Version: "+(Ax.animation.markup.revision?Ax.animation.markup.revision:"Unknown")+"<br />Creation Date: "+((Ax.animation.markup.creation)?Ax.animation.markup.creation:"Unknown")+"<br />Last Modified Date: "+((Ax.animation.markup.modified)?Ax.animation.markup.modified:"Unknown")+"<br />Contributors: "+((Ax.animation.markup.contrib)?Ax.animation.markup.contrib:["Unknown"]).join(",")+"<br />Size: "+Ax.export_animation(Ax.animation.markup,"json").length+"<br />Layers: "+Ax.tstat.layers+"<br />Frames: "+Ax.count_frames()}(new Ext.Window({title:"Animation Info - "+Ax.animation.name,iconCls:"tb_about",width:300,height:200,layout:"fit",items:{border:false,html:Ax.animationinfo("core")},buttons:[{text:"Update",iconCls:"reload_icon",handler:function(){this.ownerCt.items.first().body.update(Ax.animationinfo("core"))}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}]})).show(document.body)};Ax.save={text:function(){(new Ext.Window({title:"Save Animation As Text",iconCls:"tb_save",width:300,height:300,buttons:[{text:"Update",iconCls:"reload_icon",handler:function(){this.ownerCt.findById("outtext").setValue(Ax.export_animation(Ax.animation.markup,"json"))}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}],layout:"border",items:[{region:"north",border:false,html:"You may copy the text below and save it somewhere to open later from the File->Open->From Text menu option."},{region:"center",layout:"fit",border:false,items:{id:"outtext",xtype:"textarea",style:"font-size: 9px",value:Ax.export_animation(Ax.animation.markup,"json")}}]})).show(document.body)},computer:function(C,B,A){Ext.Ajax.request({url:Ax.files.save_proxy,params:{action:"test"},success:function(D){if(D.responseText="working"){Ax.save.comp_iframe(C,B,A)}else{Ax.save.comp_datauri(C)}},failure:function(){Ax.save.comp_datauri(C)}})},comp_datauri:function(B,A){window.location="data:application/octetstream;base64,"+A?B:(Ext.ux.base64.encode((B)?B:Ax.export_animation(Ax.animation.markup,"json")))},comp_iframe:function(C,B,A){Ax.msg("Saving...",'The request is being processed by the server and may take a long time depending on the size of the animation.<form id="save_form" method="POST" action="'+Ax.files.save_proxy+'"><input type="hidden" name="encoding" value="'+((A)?"base64":"raw")+'"><input type="hidden" name="name" value="'+((B)?B:Ax.animation.name)+'" /><input type="hidden" name="action" value="work" /></form>');var D=document.createElement("input");D.type="hidden";D.name="data";D.value=(C)?C:Ax.export_animation(Ax.animation.markup,"json");Ext.get("save_form").dom.appendChild(D);Ext.get("save_form").dom.submit()}};Ax.open={text:function(){(new Ext.Window({title:"Open Animation From Text",iconCls:"tb_open",width:300,height:300,buttons:[{text:"Load",iconCls:"load",handler:function(){Ax.autoimport(this.ownerCt.findById("loadtext").getValue())}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}],layout:"border",items:[{region:"north",border:false,html:"Paste some data acquired from the save to text button here."},{region:"center",layout:"fit",border:false,items:{id:"loadtext",xtype:"textarea",style:"font-size: 9px"}}]})).show(document.body)},file:function(){(new Ext.Window({title:"Open Animation From Computer",iconCls:"tb_open",width:400,height:105,buttons:[{text:"Load",iconCls:"load",handler:function(){this.ownerCt.findById("loadform").form.submit({url:Ax.files.open_proxy,success:function(A,B){Ax.autoimport(Ext.util.JSON.encode(B.result.data))},failure:function(A,B){Ax.toastMsg("Upload Failed",B.failureType+B.result.error+" Animation could not be loaded. If trying again fails, try pasting the file's contents into the Open from Text dialog.")}});Ext.Ajax.request({url:Ax.files.open_proxy,params:{action:"test"},success:function(A){if(A.responseText!="working"){Ax.toastMsg("Probable Failure","Upload handling server appears not to be working")}},failure:function(){Ax.toastMsg("Probable Failure","Upload handling server appears not to be working")}})}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}],border:false,items:[{layout:"fit",html:"Please locate the saved animation from your computer.",border:false},{border:false,id:"loadform",xtype:"form",fileUpload:true,listeners:{beforeaction:function(){Ax.msg("Uploading Data","The animation file is being uploaded to the server.")}},items:[{name:"file",xtype:"field",fieldLabel:"Animation File",inputType:"file"},{name:"action",xtype:"hidden",value:"work"}]}]})).show(document.body)},url:function(){(new Ext.Window({title:"Open Animation From URL",iconCls:"tb_open",width:350,height:100,buttons:[{text:"Load",iconCls:"load",handler:function(){Ext.MessageBox.alert("Functionality Disabled","Loading an animation from an external server has been disabled for (pseudo) security purposes.")}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}],border:false,items:[{layout:"fit",html:"Place the location of the online resource to load from.",border:false},{label:"URL",id:"loadurl",style:"width: 100%",xtype:"textfield"}]})).show(document.body)}};Ax.ex={};Ax.ex.array=function(E){Ax.autodiff();var D=Ax.export_animation_core(),B=[],F=1,A=Ax.count_frames(D);for(;;F++){B.push([]);for(var C in D){if(D[C].keyframes.indexOf(F)!=-1){B[F-1]=B[F-1].concat(D[C].src[F])}else{if(Ax.largest_nonempty(F,C,D)&&Ax.smallest_nonempty(F,C,D)){B[F-1]=B[F-1].concat(Ax.getSFTween(F,Ax.largest_nonempty(F,C,D),Ax.smallest_nonempty(F,C,D),C,D[C].src))}else{if(Ax.largest_nonempty(F,C,D)){B[F-1]=B[F-1].concat(D[C].src[Ax.largest_nonempty(F,C,D)])}else{}}}if(F>=A){if(E=="json"){return Ext.util.JSON.encode(B)}else{return B}}}}};Ax.ex.array.save=function(){Ax.msg("Notes on exporting to OnlyPaths JSON Frame List","Export to OnlyPaths JSON Frame List does not contain layer or tween data.");Ax.save.computer(Ext.util.JSON.encode(Ax.ex.array()),Ax.animation.name+".opf")};Ax.ex.swf=function(){return false};Ax.ex.swf.save=function(){Ax.msg("Notes on exporting to Flash","Export to flash currently uses the limited freemovie library. Better flash export will be available later using another library such as Transform SWF. ");Ax.ex.swf.check()};Ax.ex.swf.check=function(){Ext.Ajax.request({url:Ax.files.export_swf,params:{action:"test"},success:function(A){if(A.responseText!="working"){Ax.ex.swf.connect_fail()}else{Ax.ex.swf.upload()}},failure:function(){Ax.ex.swf.connect_fail()}})};Ax.ex.swf.upload=function(){Ext.Ajax.request({url:Ax.files.export_swf,params:{action:"work",animation:Ax.ex.array("json")},success:function(A){Ax.save.computer(A.responseText,Ax.animation.name+".swf",true)},failure:function(){Ax.ex.swf.connect_fail()}})};Ax.ex.swf.connect_fail=function(){Ax.toastMsg("Error!","Connection to SWF (Flash) compilier failed!")};Ax.ex.silverlight=function(){var E=Ax.ex.array(),B='<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">\n',A="";for(var C=0;C<E.length;C++){content=[];for(var D=0;D<E[C].length;D++){switch(E[C][D].type){case"line":content.push(Ax.ex.silverlight.line(E[C][D]));break;case"rect":content.push(Ax.ex.silverlight.rect(E[C][D]));break;case"ellipse":content.push(Ax.ex.silverlight.ellipse(E[C][D]));break;case"path":content.push(Ax.ex.silverlight.path(E[C][D]));break;case"text":content.push(Ax.ex.silverlight.text(E[C][D]));break;case"image":content.push(Ax.ex.silverlight.image(E[C][D]));break}}A+=content.join("\n")+"\n"}return B+A+"</Canvas>"};Ax.ex.silverlight.line=function(A){return new Ext.XTemplate('<Line X1="{left}" Y1="{top}" Fill="{fillColor}" Stroke="{lineColor}" X2="{[values.left+values.width]}" Y2="{[values.top+values.height]}"  StrokeThickness="{lineWidth}" />').apply(A)};Ax.ex.silverlight.rect=function(A){return new Ext.XTemplate('<Rectangle Canvas.Left="{left}" Canvas.Top="{top}" Fill="{fillColor}" Stroke="{lineColor}" Width="{width}" Height="{height}" StrokeThickness="{lineWidth}"><Rectangle.RenderTransform><RotateTransform Angle="{[Ax.parseTransform(values.transform)[0]]}"/></Rectangle.RenderTransform></Rectangle>').apply(A)};Ax.ex.silverlight.path=function(A){return new Ext.XTemplate('<Path Data="{points}"  Fill="{fillColor}" Stroke="{lineColor}" StrokeThickness="{lineWidth}" />').apply(A)};Ax.ex.silverlight.text=function(A){return new Ext.XTemplate('<TextBlock FontSize="{textSize}" Fill="{fillColor}" Stroke="{lineColor}"  FontFamily="{textFamily}" Canvas.Left="{left}" Canvas.Top="{top}">{text}</TextBlock>').apply(A)};Ax.ex.silverlight.image=function(A){return new Ext.XTemplate('<Rectangle Canvas.Left="{left}" Canvas.Top="{top}" Width="{width}" Height="{height}"><Rectangle.Fill><ImageBrush ImageSource="{href}" /></Rectangle.Fill></Rectangle>').apply(A)};Ax.ex.silverlight.ellipse=function(A){return new Ext.XTemplate('<Ellipse Canvas.Left="{left}" Fill="{fillColor}" Stroke="{lineColor}" StrokeThickness="{lineWidth}" Canvas.Top="{top}" Width="{width}" Height="{height}" />').apply(A)};Ax.ex.silverlight.save=function(){Ax.msg("Notes on exporting to Silverlight (XAML)","Export to Silverlight is not complete, animations will be condensed to a single canvas of overlapping shapes and some shape data may not be exported.");Ax.save.computer(Ax.ex.processing(),Ax.animation.name+".pde")};Ax.ex.javafx=function(){};Ax.ex.javafx.save=function(){Ext.MessageBox.alert("JavaFX Export Not Available","We have not finished implementing JavaFX export.")};Ax.ex.processing=function(){var F=Ax.ex.array(),B=["//The compilier for this was quickly hacked together","int frame = 0;\nint frame_total = "+F.length+";","void setup(){","size(480, 272);","frameRate(12);","smooth();","}\n"].join("\n"),E=[],A=["void draw(){","if(frame != frame_total){","frame += 1;","}else{","frame = 1;","}","background(#FFFFFF);","switch(frame){\n"].join("\n");for(var C=0;C<F.length;C++){E=[];for(var D=0;D<F[C].length;D++){E.push(Ax.ex.processing.stroke(F[C][D]));E.push(Ax.ex.processing.strokewidth(F[C][D]));E.push(Ax.ex.processing.fill(F[C][D]));switch(F[C][D].type){case"line":E.push(Ax.ex.processing.line(F[C][D]));break;case"rect":E.push(Ax.ex.processing.rect(F[C][D]));break;case"ellipse":E.push(Ax.ex.processing.ellipse(F[C][D]));break;case"text":E.push(Ax.ex.processing.text(F[C][D]));break}}A+="case "+(C+1)+":\n"+E.join("\n")+"\nbreak;\n"}return B+A+"}\n}"};Ax.ex.processing.stroke=function(A){return"stroke("+A.lineColor+");"};Ax.ex.processing.strokewidth=function(A){return"strokeWeight("+A.lineWidth+");"};Ax.ex.processing.fill=function(A){return"fill("+A.fillColor+");"};Ax.ex.processing.line=function(A){return"line("+[A.left,A.top,A.left+A.width,A.top+A.height].join(", ")+");"};Ax.ex.processing.text=function(A){return"text("+['"'+A.text+'"',A.left,A.top].join(", ")+");"};Ax.ex.processing.rect=function(A){return"rect("+[A.left,A.top,A.width,A.height].join(", ")+");"};Ax.ex.processing.ellipse=function(A){return"ellipse("+[A.left,A.top,A.width,A.height].join(", ")+");"};Ax.ex.processing.save=function(){Ax.msg("Notes on exporting to Processing","Export to processing is not complete, data such as images, paths, polygons, and rotation will not be exported.");Ax.save.computer(Ax.ex.processing(),Ax.animation.name+".pde")};Ax.ex.gif=function(){return false};Ax.ex.gif.save=function(){Ax.msg("Notes on exporting to Animated GIF","Export to Animated GIF is not complete, data such as images and rotation will not be exported.");Ax.ex.gif.check()};Ax.ex.gif.check=function(){Ext.Ajax.request({url:Ax.files.export_gif,params:{action:"test"},success:function(A){if(A.responseText!="working"){Ax.ex.gif.connect_fail()}else{Ax.ex.gif.upload()}},failure:function(){Ax.ex.gif.connect_fail()}})};Ax.ex.gif.upload=function(){Ext.Ajax.request({url:Ax.files.export_gif,params:{action:"work",width:Ax.canvasWidth,height:Ax.canvasHeight,animation:Ax.ex.array("json")},success:function(A){Ax.save.computer(A.responseText,Ax.animation.name+".gif",true)},failure:function(){Ax.ex.gif.connect_fail()}})};Ax.ex.gif.connect_fail=function(){Ax.toastMsg("Error!","Connection to GIF compilier failed!")};Ax.tips_array=[];Ax.showTips=function(){if(!Ax.tipsWindow){Ax.tipsWindow=new Ext.Window({title:"Tip of the Day - Ajax Animator",iconCls:"tb_tip",layout:"border",width:300,height:200,minimizable:true,items:[{region:"north",html:"<center><h1 class='tiptitle'>Did you know...?</h1></center><br>",border:false},{region:"center",html:Ax.getTipData(),border:false}],buttons:[{text:"Previous",iconCls:"arrow_prev",handler:function(){Ax.tipIndex--;this.ownerCt.layout.center.panel.body.update(Ax.getTipData())}},{text:"Next",iconCls:"arrow_next",handler:function(){Ax.tipIndex=(Ax.tipIndex+1)%Ax.tips_array.length;this.ownerCt.layout.center.panel.body.update(Ax.getTipData())}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}]});Ax.tipsWindow.on("minimize",function(){Ax.tipsWindow.toggleCollapse()});Ax.tipsWindow.on("beforeclose",function(){Ax.tipsWindow.hide();return false})}Ax.tipsWindow.show()};Ax.getTipData=function(){if(!Ax.tipIndex){Ax.tipIndex=Math.floor(((new Date()).getTime()-2*2*2*2*2*3*3*42227*100000)/(1000*60*60*24)%Ax.tips_array.length)}return"<center>"+Ax.tips_array[Ax.tipIndex]+"</center>"};Ax.About=function(){var A=new Ext.Window({closable:true,iconCls:"tb_about",width:410,height:300,minimizable:true,title:"About Ajax Animator",border:false,plain:true,layout:"border",buttons:[{text:"Close",iconCls:"close",handler:function(){A.close()}}],items:[{region:"north",baseCls:"ajaxanimator_logo",height:70},{xtype:"tabpanel",region:"center",margins:"3 3 3 0",activeTab:0,defaults:{autoScroll:true},items:[{title:"Version",html:"<b>Ajax Animator "+Ax.v.release+"</b><br />App Name: "+Ax.v.app+"<br />Release: "+Ax.v.release+"<br />Stability: "+Ax.v.stability+"<br />Build: "+Ax.v.build+"<br />Format revision: "+Ax.format.revision+"<br />Format Revision Support: "+Ax.format.support.min+" - "+Ax.format.support.max+"<br />OnlyPaths Version: "+Ax.onlypaths.version+"<br />Testing: "+Ax.v.dev+"<br />Release Date: "+Date.parseDate(Math.round(Ax.v.date),"U")+" ("+Ax.v.date+")<br />"},{title:"Credits",html:"<b>Developers</b><br />Antimatter15<br /><b>Documentation</b><br />Antimatter15<br />Bruce Wainer (Brwainer) - Manual<br />RandomProductions - FAQ<br /><b>Libraries/Extensions</b><br /><i>Note: This is not a fully comprehensive list of everything used</i><br />Ext v2.1 (http://extjs.com)<br />Ext 2.x themes by Galdaka, J.C., madrabaz, and elyxr<br />Ext.ux.ToastWindow by efattal<br />Ext.ux.Crypto by vtswingkid<br /><b>Patches/Bugfixes</b><br />http://extjs.com/forum/showthread.php?p=146135<br />http://outroot.com/extjs/bug1/<br /><b>Images/Icons</b><br />Logo by Antimatter15<br />Icons from silk by famfamfam<br />Icons from richdraw by Mark Finkle<br />Loading icon from ajaxload.info<br /><b>OnlyPaths</b><br />Icons from OnlyPaths by josep_ssv<br />OnlyPaths by josep_ssv<br />RichDraw by Mark Finkle<br />Sylvester by James Coglan<br />"},{title:"Special Thanks",html:"<b>Organizations</b><br />liveswifers.org for their supportive community, and helping this project get started<br />110mb.com hosting, for their reliability, cost (none), and helpful community<br />Google Code for svn and project hosting - and just being awesome<br />Extjs.com forums for excellent support<br /><b>People</b><br />inportb from 110mb forums for commentary<br />brwainer from liveswifers.org for initial documentation, ideas, and suggestions<br />BenjaminJ from liveswifers.org for support and ideas<br />Brent Clancy (brclancy111/liveswif-050) for base login system<br />RandomProductions for suggestions, fonts, and ideas<br />OutOfLine for nice comments and motivation<br />shanep for creating a forum for the project on liveswifers forums<br />"},{title:"License",html:"GPL v3 (http://www.gnu.org/licenses/gpl-3.0.txt) <br /><br />"+Ax.gpl+" <br /><br /><i>Please don't sue me</i>"}]}]});A.on("minimize",function(){A.toggleCollapse()});A.show()};Ax.gpl="This program is free software: you can redistribute it and/or modify<br />it under the terms of the GNU General Public License as published by<br />the Free Software Foundation, either version 3 of the License, or<br />(at your option) any later version.<br /><br /><br />This program is distributed in the hope that it will be useful,<br />but WITHOUT ANY WARRANTY; without even the implied warranty of<br />MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br />GNU General Public License for more details.<br /><br /><br />You should have received a copy of the GNU General Public License<br />along with this program.  If not, see http://www.gnu.org/licenses/.";Ax.keys={F5:"Insert Frame",F6:"To Keyframe",F7:"Empty Frame",Enter:"Preview/Play","Page Up":"Go to Previous Frame","Page Down":"Go to Next frame",Delete:"Delete Selection","Ctrl+C":"Copy","Ctrl+X":"Cut","Ctrl+V":"Paste","Ctrl+Z":"Undo","Ctrl+Shift+Z":"Redo"};Ax.keyGuide=function(){var B="";for(var A in Ax.keys){B+="<b>"+A+"</b> "+Ax.keys[A]+"<br>"}Ext.MessageBox.alert("Keyboard Shortcuts",B)};Ax.loadTab=function(A){Ax.viewport.findById("maintabpanel").add(A).show()};Ax.loadFAQ=function(){Ax.loadTab({xtype:"faq"})};Ax.loadManual=function(){Ax.loadTab({xtype:"manual"})};Ax.FAQ=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{title:"FAQ",closable:true,iconCls:"tb_docs",layout:"fit",border:false,items:{title:"FAQ",border:true,cls:"docs",iconCls:"tb_docs",bodyStyle:"overflow: auto;",autoLoad:{url:Ax.files.faq}}});Ax.FAQ.superclass.initComponent.apply(this,arguments)}});Ext.reg("faq",Ax.FAQ);Ax.Manual=Ext.extend(Ext.Panel,{initComponent:function(){Ext.apply(this,{title:"Manual",closable:true,iconCls:"tb_docs",layout:"fit",border:false,items:{title:"Manual",border:true,iconCls:"tb_docs",cls:"docs",autoLoad:{url:Ax.files.manual}}});Ax.Manual.superclass.initComponent.apply(this,arguments)}});Ext.reg("manual",Ax.Manual);Ax.BugReport=function(){return Ax.msg("Not Available","This feature is not available");var A=new Ext.Window({closable:true,width:410,height:300,minimizable:true,title:"Report Bug",border:false,plain:true,layout:"border",buttons:[{text:"Cancel",handler:function(){A.close()}},{text:"Send (recomended)",handler:function(){Ax.msg("Sending Bug Report","We are sending your bug report... Or at least we'll make you think we are.");A.close()}}],items:[{split:true,height:80,region:"north",html:"Hai"},{region:"center",html:"scarey"}]});A.on("minimize",function(){A.toggleCollapse()});A.show()};Ax.comment=function(){Ax.msg("Not Available","This feature is not available")};Ax.donate=function(){Ext.MessageBox.alert("Helping the Ajax Animator","If you enjoy using the Ajax Animator and would like to help assist the project, please use the ad-supported version, report bugs, comment on desired features and spread the word.")};Ax.tutorials_unavailable=function(){Ext.MessageBox.alert("Interactive Tutorials Unavaliable","Sorry, this feature is not finished yet.")};Ax.tips_array=["Double click on the bar between the canvas and the timeline to hide the timeline.","If the canvas starts to act awkwardly or fails to work at all, head over to <b>Tools->Recovery->Reload Canvas</b> and Ajax Animator will automatically try to restart the component. Don't worry, it captures the state of your current canvas and restores, so no work will be lost.","If you ever experience problems in random components, you can try reloading the animation. From the <b>Tools->Recovery</b> menu, press the <b>Reload Animation</b> button, and it'll try to rescue your project from the evils of buggy-land.","In the animation browser, or inside preview, you can press <b>Play</b> multiple times for faster playback. Be sure to press <b>Pause/Stop</b> multiple times before going to another tab though!","To make the paths you draw look more fluid, set the <b>Snapping Grid</b> (in the toolbox) to <b>1px</b>. It also gives you greater percision in control over shapes, but makes it harder to create any two shapes that are exactly the same size.","You can quickly convert a frame to a keyframe by right-clicking on it in the <b>timeline</b> and selecting <b>To Keyframe</b> from the context menu.","The text based format used by ajax animator can almost be modified by hand. It is really not too complex.","Publish (Export) to Processing, Silverlight and the Ajax Animator File Format can work offline.","The application is keyboard enabled. You can use common keystroke combinations to do various actions. Go to <b>Help->Keyboard Shortcuts</b> for details","You can tween almost any attribute of any shape, from stroke thickness, location, size, color, and opacity.","Click on the <b>Zoom</b> label on the canvas to reset the zoom to 100% (Default)","If you are working on a big animation project and it causes Ajax Animator to run slow, try splitting it up to smaller scenes.","The informal grey boxes that appear occasionally can be removed simply by clicking on them."];Ax.testserver=function(A){if(A){Ax.server_working=null}if(!Ax.server_working){Ext.Ajax.request({url:Ax.files.test+"?m=working",method:"get",success:function(B){if(B.responseText.indexOf("working")!=-1){Ax.server_working=true}else{Ax.server_working=false}},failure:function(){Ax.server_working=false}})}return Ax.server_working};Ax.urlprefs=Ext.urlDecode(window.location.search.substr(1));Ax.createBox=function(A,B){return['<div class="msg">','<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>','<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>',A,"</h3>",B,"</div></div></div>",'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',"</div>"].join("")};Ax.msg=function(D,C){if(!Ax.msgCt){Ax.msgCt=Ext.DomHelper.insertFirst(document.body,{id:"msg-div"},true)}Ax.msgCt.alignTo(document,"t-t");var B=String.format.apply(String,Array.prototype.slice.call(arguments,1));var A=Ext.DomHelper.append(Ax.msgCt,{html:Ax.createBox(D,B)},true);A.on("click",function(){Ext.get(A).remove()});A.slideIn("t").pause(10).ghost("t",{remove:true})};Ax.toastMsg=function(C,B,A){new Ext.ux.ToastWindow({title:C,html:B,iconCls:(A)?A:"error"}).show(document)};Ax.macroExec=function(){(new Ext.Window({title:"Execute Macros/Scripts",iconCls:"tb_script",width:300,height:300,buttons:[{text:"Execute",iconCls:"execute",handler:function(){eval(this.ownerCt.findById("loadtext").getValue())}},{text:"Close",iconCls:"close",handler:function(){this.ownerCt.close()}}],layout:"border",items:[{region:"north",border:false,html:"Here, you can run scripts, hacks or any javascript code."},{region:"center",layout:"fit",border:false,items:{id:"loadtext",xtype:"textarea",style:"font-size: 9px"}}]})).show(document.body)};Ax.offline=function(){Ext.MessageBox.alert("Offline Functionality Not Availiable","Offline is not availiable but most of the application should operate fine while using your browser's offline feature (if available) if icons, CSS, and scripts are properly cached. While offline, some functionality that require a server will not work such as anything User/Login, browsing user animations, and publishing to Flash/GIF.")};Ax.api={loop:{frame:function(A){var C=Ax.dumpshapes();for(var B=0;B<C.length;B++){C[B]=A(C[B])}Ax.canvas.renderer.removeAll();Ax.loadShapes(C)},number:function(C,A){for(var B=0;B<C;B++){A(B)}}},transform:{translate:function(B,A,C){B.top+=C;B.left+=A;return B},absolute:function(B,A,C){B.top=C;B.left=A;return B}},create:{shape:function(A){Ax.loadShape(A)},rect:function(B,D,C,A){Ax.canvas.renderer.create("rect",Ax.Color.fill,Ax.Color.line,Ax.Color.lineWidth,B,D,C,A)}}};Ax.exec=function(A){if(typeof Ax.plugins[A]=="function"){Ax.plugins[A]();Ax.autodiff()}else{Ax.toastMsg("Error!","Plugin Not Found!")}};Ax.plugins={};Ax.plugins.Wave=function(B,A){Ax.api.loop.frame(function(C){return Ax.api.transform.translate(C,0,B*Math.sin(C.left/C.width*A))})};Ax.plugins["Brick Wall"]=function(H,E,B,C,D,G){for(var A=0;A<C;A++){for(var F=0;F<B;F++){Ax.api.create.shape({type:"rect",top:E+(F*D),left:H+(A*G),width:G,height:D})}}};Ax.plugins.Explode=function(){Ax.api.loop.frame(function(A){return Ax.api.transform.absolute(A,Math.round(Math.random()*(Ax.canvasHeight-A.height)),Math.round(Math.random()*(Ax.canvasWidth-A.width)))})};Ax.plugins["Random Shape"]=function(){Ax.api.create.shape({type:"rect",top:Math.random()*Ax.canvasHeight,left:Math.random()*Ax.canvasWidth,width:Math.random()*Ax.canvasHeight,height:Math.random()*Ax.canvasHeight,fillColor:"#"+Ax.toHex(Math.random()*255)+Ax.toHex(Math.random()*255)+Ax.toHex(Math.random()*255),lineColor:"#"+Ax.toHex(Math.random()*255)+Ax.toHex(Math.random()*255)+Ax.toHex(Math.random()*255),lineWidth:Math.random()*20})};Ax.plugins_unavailable=function(){Ax.msg("Not Available","This feature is not available.")};Ext.onReady(function(){Ax.keymap=new Ext.KeyMap(document,[{key:117,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.toKeyframe()}},{key:116,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.insertFrame()}},{key:118,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.toBlank()}},{key:13,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.controls.play()}},{key:33,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.controls.previous()}},{key:46,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.setTool("delete")}},{key:34,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.controls.next()}},{key:"c",ctrl:true,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.clipboard_copy()}},{key:"x",ctrl:true,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.clipboard_cut()}},{key:"v",ctrl:true,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.clipboard_paste()}},{key:"z",ctrl:true,shift:false,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }if(A.shiftKey==false){Ax.history_undo()}}},{key:"z",ctrl:true,shift:true,fn:function(B,A){if(!Ax.verify_keydown(B,A)){return }Ax.history_redo()}}])});Ax.verify_keydown=function(B,A){if([116,117,118].indexOf(B)!=-1){A.stopEvent()}var C;if(window.getSelection){C=window.getSelection().toString()}else{if(document.selection){C=document.selection.createRange()}}if(C.length>1){return }if(["input","textarea"].indexOf(A.getTarget().tagName.toLowerCase())==-1){A.stopEvent();return true}return };Ext.onReady(function(){setTimeout(function(){Ext.get("loading").remove();Ext.get("loading-mask").fadeOut({remove:true});setTimeout(function(){Ax.initTimeline();Ax.addLayer();Ax.addFrames(99);if(Ax.urlprefs.draw!="false"){Ax.drawinit()}Ax.selectFrame(1,"Layer 1");setTimeout(function(){if(!window.developer){if(Ax.v.dev){new Ext.ux.ToastWindow({title:"Testing Release",html:"You are running an unstable testing release. It is not intended for normal use. Please report bugs and post comments about this release (build "+Ax.v.build+") frequently. Happy Testing!"}).show(document)}else{new Ext.ux.ToastWindow({title:"Beta Release",delay:10000,html:"There's a reason it's beta, there may be <i>a lot</i> of bugs, some more annoying than others. So please report bugs, post comments, and be a nice person."}).show(document)}if(Ext.isIE){Ext.MessageBox.alert("Notes on Microsoft Internet Explorer","Currently, support for Microsoft Internet Explorer (6/7/8) are only experimental. Some features do not work properly such as animation and playback of some specific animations. The issues are being fixed, but in the mean time, you may try out another browser such as <a href='http://getfirefox.com'>Firefox</a>, <a href='http://opera.com'>Opera</a>, or <a href='http://apple.com/safari'>Safari</a>.")}else{Ax.showTips()}}},100)},150)},250)});
