if(!Array.prototype.push){
Array.prototype.push=function(_1){
this[this.length]=_1;
};
}
var EventManager={_registry:null,isSafari:false,Initialise:function(){
if(this._registry==null){
this._registry=[];
this.isSafari=(navigator.userAgent.toLowerCase().indexOf("safari")>=0);
EventManager.Add(window,"unload",this.CleanUp);
}
},Add:function(_2,_3,fn,_5){
this.Initialise();
if(typeof _2=="string"){
_2=document.getElementById(_2);
}
if(_2==null||fn==null){
return false;
}
if(this.isSafari){
if(typeof _2["on"+_3]=="function"){
tmp=_2["on"+_3];
_2["on"+_3]=function(){
return tmp()&&fn();
};
}else{
_2["on"+_3]=fn;
}
}
if(_2.addEventListener){
_2.addEventListener(_3,fn,_5);
this._registry.push({obj:_2,type:_3,fn:fn,useCapture:_5});
return true;
}
if(_2.attachEvent&&_2.attachEvent("on"+_3,fn)){
this._registry.push({obj:_2,type:_3,fn:fn,useCapture:false});
return true;
}
return false;
},CleanUp:function(){
for(var i=0;i<EventManager._registry.length;i++){
with(EventManager._registry[i]){
EventManager.Clear(obj,type,fn,useCapture);
}
}
EventManager._registry=null;
},ClearAll:function(_7,_8){
var e;
for(var i=0;i<EventManager._registry.length;i++){
e=EventManager._registry[i];
if(e.obj===_7&&(!_8||e.type==_8)){
EventManager.Clear(e.obj,e.type,e.fn,e.useCapture);
}
}
},Clear:function(_b,_c,fn,_e){
if(this.isSafari){
_b["on"+_c]=null;
}else{
if(_b.removeEventListener){
_b.removeEventListener(_c,fn,_e);
}else{
if(_b.detachEvent){
_b.detachEvent("on"+_c,fn);
}
}
}
}};

