Separate js from html

Split all Javascript from main html structure and created main.js.