Well, first $username will need to be defined before you print the <head> statement to the browser.
And you need to break the HTML output to the browser and echo the $username variable from <? echo $username; ?> command then restart your HTML output. Like this:
<head>
<SCRIPT LANGUAGE="JavaScript">
function profile() {
window.open('http://pimpshack.net/bb/profile.php?username='<? echo $username; ?>','Profile','resizable=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=480,height=400');
}
</SCRIPT>
</head>
So long as the $username variable is defined before this HTML output is sent to the browser, you should be fine.
Hope this helps.
-b