(function(a){a.current_id=0;a.fn.generateId=function(b){if(b===undefined){b="userid_"}return this.each(function(){var c=a(this);if(!c.attr("id")){var d=b+(a.current_id++);c.attr("id",d)}})};a.fn.getIdSelector=function(b){if(this.length==0){return undefined}this.generateId(b);return"#"+this.eq(0).attr("id")}})(jQuery);function ns(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;e++){f=b[e].split(".");g=window;for(c=0;c<f.length;c++){g[f[c]]=g[f[c]]||{};g=g[f[c]]}}return g}ns("utils");utils.extend=function(d,e,c){var b=function(){};b.prototype=e.prototype;d.prototype=new b();d.prototype.constructor=d;d.superclass=e.prototype;if(e.prototype.constructor==Object.prototype.constructor){e.prototype.constructor=e}if(c){for(var a in c){d.prototype[a]=c[a]}}};Offset=function(b,a){this.left=0;this.top=0;this.setup(b,a)};Offset.prototype={setup:function(b,a){if(b instanceof Object){this.left=b.left;this.top=b.top}else{if(b!==undefined){this.left=b}if(a!==undefined){this.top=a}}return this},add:function(b,a){var c=new Offset(b,a);this.left+=c.left;this.top+=c.top;return this},sub:function(b,a){var c=new Offset(b,a);this.left-=c.left;this.top-=c.top;return this},getCopy:function(){return new Offset(this)}};Size=function(b,a){this.width=0;this.height=0;this.setup(b,a)};Size.prototype={setup:function(b,a){if(b instanceof Object){this.width=b.width;this.height=b.height}else{if(b!==undefined){this.width=b}if(a!==undefined){this.height=a}}return this},add:function(c,a){var b=new Size(c,a);this.width+=b.width;this.height+=b.height;return this},sub:function(c,a){var b=new Size(c,a);this.width-=b.width;this.height-=b.height;return this},getCopy:function(){return new Size(this)}};Frame=function(d,c,b,a){this.offset=new Offset();this.size=new Size();this.setup(d,c,b,a)};Frame.prototype={setup:function(d,c,b,a){if(d instanceof Object){this.setOffset(d);if(c){this.setSize(c)}}else{this.offset.setup(d,c);this.size.setup(b,a)}return this},setSize:function(b,a){this.size.setup(b,a);return this},setOffset:function(b,a){this.offset.setup(b,a);return this},getRight:function(){return this.offset.left+this.size.width},getBottom:function(){return this.offset.top+this.size.height},getXC:function(){return this.offset.left+this.size.width/2},getYC:function(){return this.offset.top+this.size.height/2},getCenter:function(){return new Offset(this.getXC(),this.getYC())},getCopy:function(){return new Frame(this.offset,this.size)},setRight:function(a){this.offset.left=a-this.size.width},setBottom:function(a){this.offset.top=a-this.size.height},testX:function(a){return a>=this.offset.left&&a<=this.getRight()},testY:function(a){return a>=this.offset.top&&a<=this.getBottom()},testPoint:function(a,b){return this.testX(a)&&this.testY(b)}};Function.prototype.createDelegate=function(c,b,a){var d=this;return function(){var f=b||arguments;if(a===true){f=Array.prototype.slice.call(arguments,0);f=f.concat(b)}else{if(typeof a=="number"){f=Array.prototype.slice.call(arguments,0);var e=[a,0].concat(b);Array.prototype.splice.apply(f,e)}}return d.apply(c||window,f)}};String.prototype.entityDecode=function(){return this.replace("&gt;",">").replace("&lt;","<").replace("&quot;",'"').replace("&#039;","'").replace("&amp;","&")};ns("utils");utils.Observable=function(a){this.listeners={};if(!this.events){this.events={}}if(a){$.extend(this,a)}this.addListeners(this.listeners)};utils.Observable.prototype={addEvents:function(a){this.events=$.extend(this.events||{},a)},addListeners:function(b){var c=this;var a=b.scope?b.scope:window;$.each(b,function(d,e){var f=a;if(!$.isFunction(e)){if(e.scope){f=e.scope}e=e.handler}c.addListener(d,e,f)})},addListener:function(a,c,b){if(!(this.events[a] instanceof Array)){this.events[a]=[]}this.events[a].push([c,b])},on:function(a,c,b){this.addListener(a,c,b)},fireEvent:function(d,c){if(!(this.events[d] instanceof Array)){return true}var a=true;if(!c){c=[]}for(var e=0,b=this.events[d].length;e<b;e++){var g=this.events[d][e][0];var f=this.events[d][e][1];if(!f){f=window}if(g.apply(f,c)===false){a=false}}return a}};
