function EventHandler()
{
	this.events = new Array();
	
	this.subscribe = function(eventName, callback)
	{
		if (this.events[eventName] == null)
		{
			this.events[eventName] = new Array();
		}
		
		this.events[eventName].push(callback);
	}
	
	this.fire = function(eventName, arguments)
	{
		if (eventName in this.events)
		{
			for (var i in this.events[eventName])
			{
				if (!arguments) this.events[eventName][i]();
				else this.events[eventName][i](arguments);
			}
		}
	}
}

var eventHandler = new EventHandler();

jQuery.fn.present = function(file, mode, options, fptr)
{
	var allOptions = { mode:mode };
	
	if (typeof options != 'undefined')
	{
		allOptions = $.extend(allOptions, options);
	}
	
	var target = $(this);
	
	target.html("");
	
	jQuery.post(file, allOptions, function(data)
	{
		target.html(data);
		target.show();
		
		if (typeof fptr != 'undefined') fptr(data);
	});
};

jQuery.fn.checked = function(value)
{
	if (typeof value == 'undefined')
	{
		return ($(this).is(":checked") && $(this).attr("checked"));
	}
	else
	{
		$(this).attr('checked', value);
	}
};
