Popup question

I made a gallery in Flash MX 2004. When a user clicks on a thumbnail, I want to link to the picture. I want the popupwindow that holds the picture and sizes directly around it. Sort of like this guy’s site:

He uses a JavaScript Popup window function… I would have the flash movie link to the url of my picture, but is there any way that i could embed this javascript code into the html page so that when i click the thumbnail, it goes straight to the popup window?