Cross browser add and remove events - with init-time branching.

From 'JavaScript Patterns' (O'Reilly) by Stoyan Stefanov.