Moved game code into seperate js file now called game.js, the entry point in the index.html file is now onload=init().