<!-- //

if(!is_ie&&HTMLDocument&&HTMLElement) {
	Window.prototype.attachEvent = HTMLDocument.prototype.attachEvent = HTMLElement.prototype.attachEvent = function(_t, _h) { // _t : event type, _h : handler
		_h._ieEmuEventHandler = function(e) {
			window.event = e;
			return _h();
		}
		this.addEventListener(_t.replace(/on/i, ""), _h._ieEmuEventHandler, false);
	}

	Window.prototype.detachEvent = HTMLDocument.prototype.detachEvent = HTMLElement.prototype.detachEvent = function(_t, _h) { // _t : type, _h : handler
		if(typeof(_h._ieEmuEventHandler)=="function")
			this.removeEventListener(_t.replace(/on/i, ""), _h._ieEmuEventHandler, false);
		else
			this.removeEventListener(_t.replace(/on/i, ""), _h, true);
	}
}

if(!is_ie&&Event) {
	Event.prototype.__defineSetter__("returnValue", function(_b) {
		if(!_b) this.preventDefault();
		return _b;
	});

	Event.prototype.__defineSetter__("cancelBubble", function(_b) {
		if(_b) this.stopPropagation();
		return _b;
	});

	Event.prototype.__defineGetter__("srcElement", function() {
		var _n = this.target;
		while(_n.nodeType!=1) _n = _n.parentNode;
		return _n;
	});

	Event.prototype.__defineGetter__("fromElement", function() {
		var _n;
		if(this.type=="mouseover") _n = this.relatedTarget;
		else if(this.type=="mouseout") _n = this.target;
		if(!_n) return;
		while(_n.nodeType!=1) _n = _n.parentNode;
		return _n;
	});

	Event.prototype.__defineGetter__("toElement", function() {
		var _n;
		if(this.type=="mouseout") _n = this.relatedTarget;
		else if(this.type=="mouseover") _n = this.target;
		if(!_n) return;
		while(_n.nodeType!=1) _n = _n.parentNode;
		return _n;
	});

	Event.prototype.__defineGetter__("offsetX", function () { return this.layerX; });
	Event.prototype.__defineGetter__("offsetY", function () { return this.layerY; });
}

// -->