I have a JavaScript that deals with with detection whether the page is in frames or not. I used top.frames[] etc. and everything works fine.
In this script I notice
window and self both refer to the global object of the current web page.
window
self
For more info have a look at http://www.howtocreate.co.uk/tutorials/javascript/browserinspecific