/* A general function that associates an object instance with an event
 *    handler. The returned inner function is used as the event handler.
 *       The object instance is passed as the - obj - parameter and the name
 *          of the method that is to be called on that object is passed as the -
 *             methodName - (string) parameter.
 *             */
function associateObjWithEvent(obj, methodName){
        /* The returned inner function is intended to act as an event
         *        handler for a DOM element:-
         *            */
        return (function(e){
                        /* The event object that will have been parsed as the - e -
                         *            parameter on DOM standard browsers is normalised to the IE
                         *                       event object if it has not been passed as an argument to the
                         *                                  event handling inner function:-
                         *                                          */
                    e = e||window.event;
                            /* The event handler calls a method of the object - obj - with
                             *            the name held in the string - methodName - passing the now
                             *                       normalised event object and a reference to the element to
                             *                                  which the event handler has been assigned using the - this -
                             *                                             (which works because the inner function is executed as a
                             *                                                        method of that element because it has been assigned as an
                             *                                                                   event handler):-
                             *                                                                           */
                            return obj[methodName](e, this);
                                });
}


