﻿// Functions to aid handling events

// General function for adding an event listener
function addEvent(obj, evType, fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	} else {
		//alert(evType + ' handler could not be attached');
	}
}

// Specific function for this particular browser
function addKeyEvent(obj, fn) {
	addEvent(obj, 'keydown', fn, false);
}
