moving javascript and functions

- moving Javascript to separate file
- moving functions for game outside of init()