Separated inline JS from main interface to new file

Added main.js for all JS involved in the main interface.