/*
	adapted from:
	New Perspectives on JavaScript, 2nd Edition
	Tutorial 6
	Tutorial Case

	Author:   Pete Burnham
	Date:     3/1/2011
	Filename: kgfunctions.js

	addEvent(object, evName, fnName, cap)
      Assigns an event handers to object where evName is the name of the event,
      fnName is the name of the function, and cap is the capture phase.
      This function works for both the IE and W3C event models.

   removeEvent(object, evName, fnName, cap)
      Removes an event handers from object where evName is the name of the event,
      fnName is the name of the function, and cap is the capture phase.
      This function works for both the IE and W3C event models.

 */
function addEvent(object, evName, fnName, cap) {
   if (object.attachEvent)
       object.attachEvent("on" + evName, fnName);
   else if (object.addEventListener)
       object.addEventListener(evName, fnName, cap);
}

function removeEvent(object, evName, fnName, cap) {
   if (object.detachEvent)
       object.detachEvent("on" + evName, fnName);
   else if (object.removeEventListener)
       object.removeEventListener(evName, fnName, cap);
}

