The Window object in JScript is declared by the Windows Scripting Host (WSH) or by Internet Explorer. This is why your script runs correctly outside of PlanetPress Watch (because double-clicking on a .js file implicitely launches WSH or some other system-defined scripting engine to execute your script).

However, PlanetPress Watch itself does not use the WSH and therefore does not provide the JS code with the Window object (nor with any other Scripting Engine-specific objects). By the same token, the WSH does not provide a standard JS script with access to the native PPWatch functions and properties. These are mutually exclusive.

There may be methods available to create - from within the JScript you're writing - an instance of the WSH object and use that instance to obtain a reference to the Window object, but that is way beyond the scope of this forum.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen