Wow, I actually knew something about web design 6 years ago!
This would be my first point of bug check. Using reserved words as variable/frame names is likely to cause issues; javascript is fairly permissive so when you use the keyword top it won't know if you're using the reserved keyword top which refers to the parent frameset, or the frame called top.Try renaming your frame from "top" to something like "topframe" (I would expect "top" could cause problems as it's similar to a reserved name).
However, I'm curious as to what you're trying to achieve by using a script here. It sounds like you want links in your other frames to always open in a main frame (rather than the frame in which the link is clicked). If that's so, you can do that without using javascript simply by adding target="framename" to the 'a' tag...