Separate javascript code to a new file