Canvas almost working: scope issue for  DOM events