var Gamependium = {
	// do nothing
}

Gamependium.event = {
	/**
	 * Our addListener corrects the scope of 'this' in callbacks
	 * see http://www.digital-web.com/articles/seven_javascript_techniques/
	 */
	addListener: function() {
		if (window.addEventListener) {
			return function(element, type, fn) {
				element.addEventListener(type, fn, false);
			};
		} else if (window.attachEvent) {
			return function(element, type, fn) {
				var f = function() {
					fn.call(element, window.event);
				};
				element.attachEvent('on' + type, f);
			};
		} else {
			return function(element, type, fn) {
				element['on' + type] = fn;
			}
		}
	}(),
	getTarget: function(element) { 
		element = element || window.event;
		return element.target || element.srcElement;
	},
	loadEvent: function(newFunc) {
		var oldOnLoad = window.onload;
		if (typeof window.onload !== 'function') {
			window.onload = newFunc;
		} else {
			window.onload = function() {
				oldOnLoad();
				newFunc();
			}
		}
	}
}
