function TSXObject(){function getTSXElement(e,n){if(e&&n)for(var t=e.getElementsByTagName("*"),i=new RegExp(n,"g"),o=new RegExp("clone","g"),r=0;r<t.length;r++)if("object"!=typeof t[r].className&&t[r].className.match(i)&&!t[r].className.match(o))return t[r]}function cloneChildren(e,n){if(e){for(var t=[],i=0;i<e.length;i++){var o=new TSXObject;o.group=e[i].group,o.name=e[i].name,o.uid=e[i].uid,o.parent=n,o.attribute=e[i].attribute,o.event=e[i].event,o.children=cloneChildren(e[i].children,o),o.executeOnClone=e[i].executeOnClone,o.cloneList=new Array,o.node=getTSXElement(o.parent.node,o.uid),o.executeOnClone&&o.node&&o.executeOnClone(o),t.push(o)}return t}return null}this.name,this.node,this.parent,this.attribute,this.event,this.children,this.cloneList=[],this.cloneIndex=null,this.updateNode=function(){this.node=getTSXElement(this.parent.node,this.uid)},this.find=function(e,n,t){var i=null,o=new Array;o.push(this);for(var r=null;0<o.length;)if((r=o.shift()).children)for(var s=0;s<r.children.length;s++)if(r.children[s].group!==e||r.children[s].name!==n||t&&r.children[s].id!==t)o.push(r.children[s]);else{var h=getTSXElement(this.node?this.node:document,r.children[s].uid);h&&(i||(i=new Array),r.children[s].node=h,i.push(r.children[s]))}return i},this.clone=function(e,n){for(var t=0;t<e;t++){var i=new TSXObject;i.group=this.group,i.name=this.name,i.uid=this.uid,i.parent=this.parent,i.attribute=this.attribute,i.event=this.event,i.executeOnClone=this.executeOnClone,i.cloneList=new Array,i.node=this.node.cloneNode(!0),i.node.className=i.node.className+" clone"+this.cloneCount(),i.cloneIndex=this.cloneCount(),i.children=cloneChildren(this.children,i),n&&n(i),this.cloneList.push(i),this.node.parentNode.insertBefore(i.node,this.node)}},this.cloneObject=function(i,o,e){try{for(var r=0;r<i.length;r++){if(i[r]){var n=new TSXObject;n.group=this.group,n.name=this.name,n.uid=this.uid,n.parent=this.parent,n.attribute=this.attribute,n.event=this.event,n.executeOnClone=this.executeOnClone,n.cloneList=new Array,n.node=this.node.cloneNode(!0),n.cloneIndex=this.cloneCount(),n.node.className=n.node.className+" clone"+n.cloneIndex,n.node.value&&(n.node.value=n.node.value.replace(/%([a-z]+)\.([a-z_]+)%/gi,function(e,n,t){return s(e,n,t)})),n.node.innerHTML=n.node.innerHTML.replace(/%([a-z]+)\.([a-z0-9_]+)%/gi,function(e,n,t){return s(e,n,t)}),n.children=cloneChildren(this.children,n),e&&e(n,i[r]),executeJavascript(n.node),this.cloneList.push(n),this.node.parentNode.insertBefore(n.node,this.node),$($(n.node).find("img")).each(function(e,n){var t=$(n).attr("data-src");t&&!t.match(/^\%/)&&$(n).attr("src",t)})}function s(e,n,t){return o===n?i[r][t]?i[r][t]:"":e}}}catch(e){console.error("Erro ao instanciar o objeto para clonagem. "+e),console.error("objeto: ",i),console.error("prefix: ",o)}},this.cloneClear=function(){for(var e=0;e<this.cloneList.length;e++)this.cloneList[e].node.parentNode.removeChild(this.cloneList[e].node);this.cloneList=new Array},this.cloneCount=function(){return this.cloneList.length},this.cloneRemove=function(e){var n,t=this.cloneList.length;for(n=0;n<t;n+=1)this.cloneList[n]&&e.node.className===this.cloneList[n].node.className&&this.cloneList.splice(n,1);this.node.parentNode.removeChild(e.node)},this.cloneGet=function(e){return this.cloneList[e]},this.setEvent=function(e,n){if(this.node){var t=this;this.node["on"+e]=function(e){t.node=this,n&&n(t,e)}}},this.dispatchEvent=function(e){this.node[e]()},this.execute=function(code,parameters){var self=this;return eval(this.attribute[code])},this.fadeIn=function(e){$(this.node).fadeIn(e)},this.fadeOut=function(e){$(this.node).fadeOut(e)},this.show=function(){this.node.style.display="block"},this.hide=function(){this.node.style.display="none"},this.value=function(e){if(this.node||this.updateNode(),void 0===e){var n=this.node.value;return n||(n=this.node.getAttribute("value")),n}this.node.value=e},this.focus=function(){this.node.focus()},this.findChild=function(e,n){var t,i,o=this.children.length,r=[];for(i=0;i<o;i+=1)(t=this.children[i]).group===e&&t.name===n&&r.push(t);return r}}var root=new TSXObject;root.group="root",root.name="root",root.uid="root",root.parent=null,root.attribute={},root.children=[];