The Referer header is sent at a browser level, but it's an important part of the HTTP standard, and it's not something that JavaScript is allowed to mess with. If it were, the security implications would be enormous. As others have said, you'd be better off using a redirector script, but keep in mind that this will need to be hosted on a different site if you want to mask your "real" site's location.
Out of curiosity, why are you trying to mask the Referer header, anyway? Are you worried about other sites banning deep-linking from your site?