Nofollow redirect & javascript link

All links on my site redirect to another page. However everything is html except for (2) javascript links I need to direct to. Links are being done on the viewable pages in the fashion:

<a href="ab/dir.php?GG=2200" rel="nofollow" target="_blank">link text</a>

Going to my internal dir page, having:

if((isset($_GET['GG']))&&($_GET['GG']=='2200')) // 

Where ‘affildomain’ is the javascript link. Which of course cannot be done this way or it gives the “File Download - Security Warning…Do you want to save this file, or find a program online to open it?”

How can this be redirected (first tag above) while using nofollow or an equivalent, connecting with this javascript:

<script type="text/javascript" language="javascript" src=""></script>

Its an affiliate link with <link>link text here</link>

Is there a way to integrate on the redirect page the window location:

I think that someone on the PHP forum may have information about how to adjust the headers to help prevent your problem.

Thread moved to php forum: