/****************************************************************
 *                                                              *
 * This library has been deprecated. The prototype library      *
 * should be used instead.                                      *
 *                                                              *
 ****************************************************************/
 
var events = {

/**
 * Returns a reference to the element associated with the event. Null, if
 * not supported by the browser.
 *
 * e		The event object
 * elName	The type of element associated with the event
 */
getEventElement: function(e, elName)
{
	var el;
	if (window.event && window.event.srcElement) {
		el = window.event.srcElement;
	}
	if (e && e.target) {
		el = e.target;
	}
	if (!el) {
		return;
	}
	while (el.nodeName.toLowerCase() != elName && el.nodeName.toLowerCase() != 'body') {
		el = el.parentNode;
	}
	return el;
},

/**
 * Cross-browser event handling for IE5+, NS6 and Mozilla
 * By Scott Andrew
 */
addEvent: function(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
},

/**
 * Prevent the event from propogating up the DOM
 */
haltPropogation: function(e) {
	if (window.event) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
	if (e && e.stopPropagation && e.preventDefault) {
		e.stopPropagation();
		e.preventDefault();
	}
}

}
