basic implementation of events; switched to HTML5