That's kind of an off approach.
What you want to do is define your page with a link that 'onclick' calls your window open script.
you can't do this with javascript alone. You'll need a technology like PHP.
1. Build an HTML page and replace userid with %USERID% - ni our example it will be template.htm
2. Build a PHP page that has available the user's id, in a SESSION variable, or POST - anything you like. If it were stored in a SESSION array it would look like this:
Code:
<?
session_name( 'somename' );
session_start();
$fp = str_replace( '%USERID%', $_SESSION['userid'], implode( '', file( 'template.html' ) );
echo $fp;
?>
this way, the php file reads the unparsed template, replaces %USERID% with the actual user id, and then echoes the result.
HTH
Alex