mrj.Element.prototype.createEvent = function (eventId, func)
{
	if (this.events == undefined) this.events = new Object();
	if (this.events[eventId] == undefined)
	{
		this.htmlElement[eventId] = function () { this.mrjElement.invokeEvent(eventId); };
		this.events[eventId] = null;
	}
	
	if (this.events[eventId] == null)
	{
		this.events[eventId] = func;
	}
	else if (typeof(this.events[eventId]) == "function")
	{
		this.events[eventId].push(func);
	}
	else
	{
		this.events[eventId] = new Array();
		this.events[eventId].push(func);
	}
}

mrj.Element.prototype.invokeEvent = function (eventId)
{
	if (this.events[eventId] != undefined)
	{
		if (typeof(this.events[eventId]) == "function")
		{
			this.events[eventId](this);
		}
		else
		{
			for (var i in this.events[eventId])
			{
				this.events[eventId][i](this);
			}
		}
	}
}

