Proper cross browser support

As the first (quick) fix was … sub-optimal, I sat down to explore some browser incompatibilities. This is the result, and the code should finally work equally well in Webkit- and Gecko-based browsers, though Trident/IE should also work flawlessly, at least recent versions. It could use some refactoring, though, to avoid repetition, be less "hacky", and more future-proof (i.e. utilize new DOM (Key) Events spec).