text: function generateGUID(){do var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0,t="x"==e?n:3&n|8;return t.toString(16)});while(GUIDList.indexOf(e)>-1);return e}function toFunc(e){if("function"==typeof e)return e;if("string"==typeof e){if(void 0!=window[e]&&"function"==typeof window[e])return window[e];try{return new Function(e)}catch(n){}}return function(){return e}}function Obj(){this._parent=null,this._handlers=[],this._onceHandlers=[],this._elements=$(),this.guid=generateGUID(),this.on=function(e,n){"function"==typeof e&&void 0===n&&(n=e,e="all"),e=e.toLowerCase().split(" ");for(var t=0;t<e.length;t++)this._handlers.push({event:e[t],handler:n});return this},this.once=function(e,n){"function"==typeof e&&void 0===n&&(n=e,e="all"),e=e.toLowerCase().split(" ");for(var t=0;t<e.length;t++)this._onceHandlers.push({event:e[t],handler:n});return this},this.off=function(e,n){if(void 0===n&&"function"==typeof e)for(var n=e,t=0;t<this._handlers.length;t++)this._handlers[t].handler==n&&this._handlers.splice(t--,1);else if(void 0===n&&"string"==typeof e){e=e.toLowerCase().split(" ");for(var t=0;t<this._handlers.length;t++)e.indexOf(this._handlers[t].event)>-1&&this._handlers.splice(t--,1)}else{e=e.toLowerCase().split(" ");for(var t=0;t<this._handlers.length;t++)e.indexOf(this._handlers[t].event)>-1&&this._handlers[t].handler==n&&this._handlers.splice(t--,1)}return this},this.offOnce=function(e,n){if(void 0===n&&"function"==typeof e)for(var n=e,t=0;t<this._onceHandlers.length;t++)this._onceHandlers[t].handler==n&&this._onceHandlers.splice(t--,1);else if(void 0===n&&"string"==typeof e){e=e.toLowerCase().split(" ");for(var t=0;t<this._onceHandlers.length;t++)e.indexOf(this._onceHandlers[t].event)>-1&&this._onceHandlers.splice(t--,1)}else{e=e.toLowerCase().split(" ");for(var t=0;t<this._onceHandlers.length;t++)e.indexOf(this._onceHandlers[t].event)>-1&&this._onceHandlers[t].handler==n&&this._onceHandlers.splice(t--,1)}return this},this.trigger=function(e,n){e=e.toLowerCase().split(" ");for(var t=0;t<this._handlers.length;t++)(e.indexOf(this._handlers[t].event)>-1||"all"==this._handlers[t].event)&&toFunc(this._handlers[t].handler).call(this,this._handlers[t].event,n);for(var t=0;t<this._onceHandlers.length;t++)(e.indexOf(this._onceHandlers[t].event)>-1||"all"==this._handlers[t].event)&&(toFunc(this._onceHandlers[t].handler).call(this,this._onceHandlers[t].event,n),this._onceHandlers.splice(t--,1));return this},this.renderer=function(){return $("<div class='Obj'></div>")},this.refresher=function(e){return this.renderer.apply(this)},this.destroyer=function(e){},this.render=function(e,n){var t=this;if(void 0===e)var e="body";if(void 0===n)var n="replace";else n=n.toLowerCase();var i=[].slice.call(arguments,2),r=this;return $(e).each(function(e,s){s=$(s);var h=$(t.renderer.apply(t,i));h.attr("guid",t.guid),t._elements=t._elements.add(h),"append"==n?s.append(h):"prepend"==n?s.prepend(h):"after"==n?s.after(h):"before"==n?s.before(h):"return"==n?r=h:"none"==n||(s.after(h),s.remove())}),this.trigger("render"),r},this.refresh=function(){for(var e=$(),n=0;n<this._elements.length;n++){var t=this._elements.eq(n),i=this.refresher.call(this,t);i?(i.attr("guid",this.guid),this._elements=this._elements.not(t),t.after(i),t.remove(),e=e.add(i)):e=e.add(t)}return this._elements=e,this},this.destroy=function(){var e=this;return this._elements.each(function(n,t){var i=$(t);e.destroyer.call(e,i)}),this._elements.remove(),this._elements=$(),delete Objs[this.guid],this},Objs[this.guid]=this}var GUIDList=[],Objs={};