var EventMgr={_registry:null,initialize:function(){if(this._registry==null){this._registry=[];EventMgr.add(window,"_unload",this.cleanup)}},add:function(E,B,D,A){this.initialize();if(typeof E=="string"){E=d.g(E)}if(E==null||D==null){return false}if(B=="unload"){this._registry.push({obj:E,type:B,fn:D,useCapture:A});return true}var C=B=="_unload"?"unload":B;this.realAdd(E,C,D,A);this._registry[this._registry.length]={obj:E,type:B,fn:D,useCapture:A};return true},realAdd:function(o,realType,fn,uc){if(realType=="load"){fn=EventMgr.init;this.realAdd(o,"error",fn,uc);this.realAdd(o,"DOMContentLoaded",fn,false);/*@cc_on @*//*@if (@_win32)
		if (document.getElementById) {
			script = document.getElementById("__ie_onload");
			if (script == window.undefined) {
				var proto = "javascript:void(0)";
				if (location.protocol == "https:") proto = "src=//0";
				document.write("<scr"+"ipt id=__ie_onload defer src=" + proto + "><\/scr"+"ipt>");

				var script = document.getElementById("__ie_onload");
				script.onreadystatechange = function() {
					if (this.readyState == "complete") {
						fn();
					}
				};
			}
		}
		/*@end @*/if(/KHTML|WebKit/i.test(navigator.userAgent)){this._timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(this._timer);delete this._timer;fn()}},10)}}if(o.addEventListener){o.addEventListener(realType,fn,uc)}else{if(o.attachEvent){o.attachEvent("on"+realType,fn)}else{o["on"+realType]=fn;if(o["on"+realType]!=fn){alert("Error adding listener\nObject:"+o+" ID:"+o.id+" Name:"+o.name+" TagName:"+o.tagName+"\nEvent:"+realType)}}}},init:function(){if(arguments.callee.done){return }arguments.callee.done=true;for(var A=0;A<EventMgr._registry.length;A++){if(EventMgr._registry[A].type=="load"){p=EventMgr._registry[A].fn()}}},remove:function(D,C,B,A){if(D.removeEventListener){D.removeEventListener(C,B,A)}else{if(D.detachEvent){D.detachEvent("on"+C,B)}else{}}return true},cleanup:function(){for(var i=0;i<EventMgr._registry.length;i++){with(EventMgr._registry[i]){if(type=="unload"){fn()}else{if(type=="_unload"){type="unload"}EventMgr.remove(obj,type,fn,useCapture)}}}delete EventMgr._registry}}
