Multi-windows support for embedded scripts

This should fix an issue with embedded scripts that are injected in a dynamically created IFRAME. If this operation is performed in the top window then the script is always evaluated there.