Lib.Utils.NamespaceUtils.createIfNecessary('Lib.Utils');

/**
* created by: Nate Minshew
* date created: 09/06/2005
* description: This is a javascript class that handles modifying events on javascript objects.  It allows you to add
*   and remove multiple events like 'onclick' and 'onchange' to html elements.  This is provided in replace of changing
*   the function that the event is set to, for example:
*
*   window.onload = function () { ... };
*
*   This is bad because no other object can now set onload events without overridding the current event.  This class
*   solves that problem.
*/
Lib.Utils.EventUtils = {};

/**
* created by: Nate Minshew
* date created: 09/06/2005
* access level: public
* description: Adds an event to the specified object.
*
* _obj - Object the event is to be applied to.
* _evType - Type of event to add, ei. 'click' for 'onclick'.
* _fn - Function to call for the event.
*/
Lib.Utils.EventUtils.addEvent = function(_obj, _evType, _fn) {
    if (_obj.addEventListener) {
        _obj.addEventListener(_evType, _fn, false);
        return true;
    } else if (_obj.attachEvent) {
        var _r = _obj.attachEvent("on" + _evType, _fn);
        return _r;
    } else {
        return false;
    }
}

/**
* created by: Nate Minshew
* date created: 09/06/2005
* access level: public
* description: Removes an event from the specified object.
*
* _obj - Object the event is to be removed from.
* _evType - Type of event to remove, ei. 'click' for 'onclick'.
* _fn - Function the event was calling.
*/
Lib.Utils.EventUtils.removeEvent = function(_obj, _evType, _fn) {
    if (_obj.removeEventListener) {
        _obj.removeEventListener(_evType, _fn, false);
        return true;
    } else if (_obj.detachEvent) {
        var _r = _obj.detachEvent("on" + _evType, _fn);
        return _r;
    } else {
        return false;
    }
}