detecting whether frame is top one and in case it isn't redrawing it as top



I tried soemthing like:

if (top != self) top.location.href = self;

or

if (window == top) top.location.replace("index.html");

doesn't work.

tia.
.