/*
Pass the function three bits of information: the object which generates 
the event (in our example, this would be the window object), the 
event name (without the "on" prefix), and the function that should be called 
when the event happens. 

cx_AttachEvent(window, "load", funcReference);
*/
function cx_AttachEvent(obj, event, func) {
    try {
        obj.addEventListener(event, func, false);
    } catch (e) {
        if (typeof obj['on'+event] == "function") {
            var existing = obj['on'+event];
            obj['on'+event] = function () { existing(); func(); };
        } else {
            obj['on'+event] = func;                        
        }
    }
} 