move code to get canvas and store mouse position into window.onload function