move js code to a file