Enclose Javascript

Keep things tidy
Split out canvas functions into separate JS file