added crossbrowser support for adding event listeners