Object.extend=function(a,c,b){for(var d in c){if(b==false&&a[d]!=null){continue}a[d]=c[d]}return a};Object.extend(Function.prototype,{apply:function(o,a){var r,x="__fapply";if(typeof o!="object"){o={}}o[x]=this;var s="r = o."+x+"(";for(var i=0;i<a.length;i++){if(i>0){s+=","}s+="a["+i+"]"}s+=");";eval(s);delete o[x];return r},bind:function(d){if(!Function.__objs){Function.__objs=[];Function.__funcs=[]}var a=d.__oid;if(!a){Function.__objs[a=d.__oid=Function.__objs.length]=d}var b=this;var c=b.__fid;if(!c){Function.__funcs[c=b.__fid=Function.__funcs.length]=b}if(!d.__closures){d.__closures=[]}var e=d.__closures[c];if(e){return e}d=null;b=null;return Function.__objs[a].__closures[c]=function(){return Function.__funcs[c].apply(Function.__objs[a],arguments)}}},false);Object.extend(Array.prototype,{push:function(a){this[this.length]=a},addRange:function(a){if(a.length>0){for(var b=0;b<a.length;b++){this.push(a[b])}}},clear:function(){this.length=0;return this},shift:function(){if(this.length==0){return null}var b=this[0];for(var a=0;a<this.length-1;a++){this[a]=this[a+1]}this.length--;return b}},false);Object.extend(String.prototype,{trimLeft:function(){return this.replace(/^\s*/,"")},trimRight:function(){return this.replace(/\s*$/,"")},trim:function(){return this.trimRight().trimLeft()},endsWith:function(a){if(this.length==0||this.length<a.length){return false}return(this.substr(this.length-a.length)==a)},startsWith:function(a){if(this.length==0||this.length<a.length){return false}return(this.substr(0,a.length)==a)},split:function(f){var b=[];if(this.length==0){return b}var e=0;for(var d=0;d<this.length;d++){if(this.charAt(d)==f){b.push(this.substring(e,d));e=++d}}b.push(s.substr(e));return b}},false);Object.extend(String,{format:function(b){for(var a=1;a<arguments.length;a++){b=b.replace("{"+(a-1)+"}",arguments[a])}return b},isNullOrEmpty:function(a){if(a==null||a.length==0){return true}return false}},false);if(typeof addEvent=="undefined"){addEvent=function(h,c,d,a){if(h==null){return false}if(h.addEventListener){h.addEventListener(c,d,a);return true}else{if(h.attachEvent){var b=h.attachEvent("on"+c,d);return b}else{try{h["on"+c]=d}catch(g){}}}}}if(typeof removeEvent=="undefined"){removeEvent=function(g,b,c,a){if(g==null){return false}if(g.removeEventListener){g.removeEventListener(b,c,a);return true}else{if(g.detachEvent){g.detachEvent("on"+b,c)}else{try{g["on"+b]=function(){}}catch(d){}}}}};
