eliminiated references to globals "navigator" and "document".

changed to "window.navigator" and "window.document" so that the injected
"window" instance is used.