I need a script that detects if the browser is viewing a certain page within a frameset, and if it is not, to open the page through frameset instead.

For example if the site has a mainframe and a navframe, if someone goes to the mainframe from a search engine, the script will open up the frameset html so the navframe shows up too.

If someone can help me with this I would appreciate it muchly.