refactored into events.js and functions.js

constructItem into functions.js and renamed to addItem, renamed main.js
to events.js