Refactoring javascript code in index.html to separate js/EventHander.js