if (!EVENT)
{
	var 
		LEFT_MOUSE		= 0,
		MIDDLE_MOUSE	= 1,
		RIGHT_MOUSE		= 2;
	// temporary variables
	var EVENT_INIT = function()
	{
		// Functions
		this.parseEvent = function(ev)
		{
			var e = EVENT.get(ev);
			e.PP = new EVENT.ev_data(ev);
			return(e);
		};
		this.init = function()
		{
			// Browser Compatibility Code
			if (PP.browser == 0)		// IE
			{
				this.ev_data = function(e) 
				{
					this.caller = e.srcElement; 
					this.x = e.x + document.body.parentNode.scrollLeft; 
					this.y = e.y + document.body.parentNode.scrollTop; 
					this.clickedButton = ((e.button < 2) ? LEFT_MOUSE : ((e.button == 4) ? MIDDLE_MOUSE : RIGHT_MOUSE)); 
				};
				this.add = function (owner,eventStr,func,args) 
				{
					if (!owner.PP_EVENTS)
						owner.PP_EVENTS = new Array();
					owner.PP_EVENTS.push(new Object({eventStr: "on" + eventStr, func: function(ev) {return(func(EVENT.parseEvent(ev),args));}}));
					owner.attachEvent(owner.PP_EVENTS[owner.PP_EVENTS.length-1].eventStr,owner.PP_EVENTS[owner.PP_EVENTS.length-1].func); 
				};
				this.clear = function(owner,doChildren)
				{
					var i;
					if (doChildren == true)
						for (i = 0 ; i < owner.childNodes.length ; i++)
							EVENT.clear(owner.childNodes[i],true);
					if (owner.PP_EVENTS)
					{
						var i;
						if (!owner.OLD_PP_EVENTS)
							owner.OLD_PP_EVENTS = new Array();
						owner.OLD_PP_EVENTS.length=0;
						for (i = 0 ; i < owner.PP_EVENTS.length ; i++)
						{
							owner.detachEvent(owner.PP_EVENTS[i].eventStr,owner.PP_EVENTS[i].func);
							owner.OLD_PP_EVENTS.push(owner.PP_EVENTS[i]);
						}
						owner.PP_EVENTS.length = 0;						
					}
				};
				this.get = function(ev) { return(window.event); };
				this.cancel = function(ev) { return false; }
			}
			else if (PP.browser == 1)	// FF
			{
				this.ev_data = function(e) 
				{ 
					this.caller = e.target; this.x = e.pageX; 
					this.y = e.pageY; 
					this.clickedButton = ((e.which < 2) ? LEFT_MOUSE : ((e.which == 2) ? MIDDLE_MOUSE : RIGHT_MOUSE)); 
				};
				this.add = function (owner,eventStr,func,args) 
				{ 
					if (!owner.PP_EVENTS)
						owner.PP_EVENTS = new Array();
					owner.PP_EVENTS.push(new Object({eventStr: eventStr, func: function(ev) {return(func(EVENT.parseEvent(ev),args));}}));
					owner.addEventListener(owner.PP_EVENTS[owner.PP_EVENTS.length-1].eventStr,owner.PP_EVENTS[owner.PP_EVENTS.length-1].func,false);
				};
				this.clear = function(owner,doChildren)
				{
					var i;
					if (doChildren == true)
						for (i = 0 ; i < owner.childNodes.length ; i++)
							EVENT.clear(owner.childNodes[i],true);
					if (owner.PP_EVENTS)
					{
						for (i = 0 ; i < owner.PP_EVENTS.length ; i++)
							owner.removeEventListener(owner.PP_EVENTS[i].eventStr,owner.PP_EVENTS[i].func,false);
						owner.PP_EVENTS.length = 0;
						owner.PP_EVENTS = new Array();
					}
				};
				this.cancel = function(e) { e.preventDefault(); return false; };
				this.get = function(e) { return(e); };
			}
		}
	
		this.init();
	};
	
	var EVENT = new EVENT_INIT();
}

