Update common-functions.js

added browser-friendly event handler function