/**
 * Logs events on the server
 * @title		Event Logger
 * @author		Colin Nolan
 * @version		v1.0.0
 * @created		28/09/11
 *
 * @param	{string} url	Location on the server to send messages to
 */
var EventLogger = function(url)
{
	/**
	 * Log an event to the server
	 * @param	{string} eventID	Event string identifier
	 * @param	{boolean} logImmediately	(Optional) Whether the log should be made immediately
	 */
	this.log = function(eventID, logImmediately)
	{
		window.setTimeout(				// Delayed to ensure that it does not effect user experience of the actual event
			function() {
				try {
					new ServerQuery(
						"GET",
						url,
						"data="+ eventID
					);
				}
				catch(e) {
					// Client browser probably doesn't support XMLHttpRequest
				}
			},
			(logImmediately) ? 0 : 750
		);
	};
};
