It's actually a complete script (about 5+ pages of JS). Yeah that's what I thought it should do, too.
The way the tabs are created is through a built in function createNewTab() which takes tab as an argument. My declaration of tab behaves correctly if i document.write() it, but then it opens in a new window when I want it to be in a frame. Perhaps the tab scripts I'm using don't allow js inside the tabs.
If I do it through the iframe method (which is commented out on my code posted above), I just see the source code -- it's not being parsed. I think the easiest thing will be for me to throw together a perl script which adds <script> tags to that then I can just put it in an iframe.
Just a thought.... have you tried using eval() for the returned js? I think this is the only way to have the js run when loaded this way. I may be wrong and would be interested in find other ways to do this.