is = {};
is.ua = window.navigator.userAgent;
is.dom = document.getElementById ? 1:0;
is.ie = is.ua.match(/msie/i) ? 1:0;	
is.ie5 = is.ua.match(/msie 5\.0/i) ? 1:0;
is.ie55 = is.ua.match(/msie 5\.5/i) ? 1:0;
is.ie6 = is.ua.match(/msie 6/i) ? 1:0;
is.moz = is.ua.match(/gecko/i) ? 1:0;
is.opera = !is.ie && !is.moz && is.ua.match(/opera/i) ? 1:0;

function $invokeEvent(el) {
	if (el.$invoked) return;
	el.addEventListener = el.aE = function(e,ref) {
		if (typeof(ref) != 'function') return;
		if (!this["_on"+e]) this["_on"+e] = [];
		this["_on"+e].push(ref);
		el['on'+e.replace(/^on/i,'')] = function(E){
			this.dE(e,E);
		};
	};
	el.removeEventListener = el.rE = function(e,ref) {
		e = this["_on"+e];
		if (!(e instanceof Array)) return;
		e.remove(ref);
	};
	el.dispatchEvent = el.dE = function(e,a,o) {
		e = this["_on"+e];
		if (e instanceof Array) {
			for(var i=0;i<e.length;i++) 
				e[i].call((o||this),a);
		}
	};
	el.$invoked = true;
};

new function() {
	if (![].push) {
		Array.prototype.push=function(){
			for(var i=0;i<arguments.length;i++)
				this[this.length]=arguments[i];
			return this.length;
		};
		Array.prototype.pop=function(){
			if(this.length>0){
				var val=this[this.length-1];
				--this.length;
				return val;
			}
		};
	}
/*	Array.prototype.exists=function(it){
		for(var i=0;i<this.length;i++)
			if(this[i]==it)break;
		return i<this.length;
	}
	Array.prototype.remove=function(it){
		for(var i=0;i<this.length;i++)
			if(this[i]==it)break;
		if(i==this.length)return;
		for(var j=i;j<this.length-1;j++)
			this[j]=this[j+1];
		--this.length;
	}*/
	if(!Function.call){
		Function.prototype.call=function(THIS,a0,a1,a2,a3,a4){
			var o=THIS||this;
			o.$call=this;
			return o.$call(a0,a1,a2,a3,a4);
		};
		Function.prototype.apply=function(THIS,argu){
			return this.call(THIS,argu[0],argu[1],argu[2],argu[3],argu[4]);
		};
	}
	$invokeEvent(window);
	$invokeEvent(document);
}