I am confused. You start by saying that you are having trouble outputting the chart to a new window but then later say that you are trying to output to the current window
If I look at you javascript I believe that this will open a new browser window. So if this is what you are tryin to do ... have you tried ...html (anchor tag) code follows
<A TARGET="_blank" HREF=""pie.pl?$passstring"">Display Pie Chart</A>
This will open the output of your pie.pl script in a NEW window..
-----
Of all the things I've lost in my life, its my mind I miss the most.