Move javascript codes into a seperate file