﻿if(!window.attachEvent){function GetEvent(){var _caller = GetEvent.caller;while(_caller){if(_caller.arguments.length == 0){_caller = _caller.caller;continue;}var obj = _caller.arguments[0];if(obj.constructor==Event||obj.constructor==MouseEvent||obj.constructor==KeyboardEvent)return obj;_caller = _caller.caller;}return null;}Window.prototype.__defineGetter__("event",GetEvent);Event.prototype.__defineSetter__("returnValue",function(v){if(!v)this.preventDefault();return v;});Event.prototype.__defineGetter__("srcElement",function(){return this.target;});Event.prototype.__defineGetter__("x",function(){return this.layerX;});Event.prototype.__defineGetter__("y",function(){return this.layerY;});Event.prototype.__defineSetter__("cancelBubble", function (value) {if (value) this.stopPropagation();});Window.prototype.attachEvent = HTMLDocument.prototype.attachEvent = HTMLElement.prototype.attachEvent = function(eventName,eventFunction){this.addEventListener(eventName.replace(/on/,""),eventFunction,true);};Window.prototype.detachEvent = HTMLDocument.prototype.detachEvent = HTMLElement.prototype.detachEvent = function(eventName,eventFunction){this.removeEventListener(eventName.replace(/on/,""),eventFunction,true);};Window.prototype.fireEvent = HTMLDocument.prototype.fireEvent = HTMLElement.prototype.fireEvent = function(eventName){var e,et;eventName = eventName.toLowerCase();if(eventName.indexOf("click")!=-1 || eventName.indexOf("mouse")!=-1)et="MouseEvents";else if(eventName.indexOf("key")!=-1)et="KeyboardEvents";else et="Events";e = document.createEvent(et);e.initEvent(eventName.replace(/on/,""),true,true);this.dispatchEvent(e);};HTMLDocument.prototype.__defineGetter__("innerText",function(){return this.textContent;});HTMLDocument.prototype.__defineSetter__("innerText",function(t){this.textContent=t;});HTMLElement.prototype.__defineGetter__("innerText",function(){return this.textContent;});HTMLElement.prototype.__defineSetter__("innerText",function(t){this.textContent=t;});HTMLElement.prototype.removeNode = function(bRemoveChildren){this.parentNode.removeChild(this);if(!bRemoveChildren){for(var i=0;i<this.childNodes.length;i++)this.parentNode.appendChild(this.childNodes[i]);}};}
function $(id){return document.getElementById(id);}