Get attachEvent working for window and document, for load and unload.