You might want to read up a bit on including javascript in pages. You should define your script type:
HTML Code:
<script type="text/javascript">
And you should enclose all javascript in comment tags:
HTML Code:
<!--
javascript
// -->
That probably has nothing to do with your problems, but those were two very obvious things I saw and I'm wondering now about the rest of the code. Did you copy it from somewhere? I'm not a javascript expert, so I can't go through your code for you to see if you wrote it correctly.
Just wondering, but.... you have the list spit out correctly in the first link, right? But the javascript isn't popping up a window, right? And the third link is to an html page which shows the working popup. And the second page is your working page (the one you are trying your code in) which is incorrect. I don't even see where you include the javascript in your second page, I just see it being spit out incorrectly. Try doing what I suggested above and see what the result is.