Introduced addEventListener for mouse events

There was a problem with the "this" keyword since "onmousedown" etc was
used together with "this". Replaced those html attributes with event
listeners.