Sometimes it is necessary to determine whether your page is loaded inside a RadWindow so that you can, for example, redirect the whole browser and not just the RadWindow. This scenario is actually related to the way iframes work in the sense that they are a separate document and thus it also applies to RadWindow, since it uses an iframe to load external pages.
The logic behind it is simple - if this page is not displayed as a topmost page (e.g directly in the browser) but in some container (like IFRAME / RadWindow /etc.) - load it as topmost page. This way when your session is expired and you open / submit a page in a RadWindow, you'll be redirected to the login page inside the RadWindow. Because of the script above, however, the login page will be loaded as topmost - directly in the browser's window.