where are the new pages being loaded from? If you're gettin these pages from another site, the other site may be checking for frames and jumping out of them.
The frames breaking is a javascript/html issue though.
I don't even know if you would be able to detect that a page broke a frame. If you could, then javascript would have to call a php script and pass in the data.
try searching comp.lang.javascript on USENET.
try here at google.
http://groups.google.com/groups?q=comp.lang.javascript