@UltimaterNov 20.2005 — #document.referrer (note the extra "R" aside from Perl)
Beware however that it can be messed with. But I'm sure that you already know this by using JavaScript in the first palce. Also note that browser settings can disable the referrer from carrying any value. If there is no referrer, it contains a blank string. Also note that people can use telnet or a serverside language to alter the referer to give the referrer a string containing HTML, or even Server Side Includes. A good majority of your users will have their browser settings disabling the referrer from being used. You'd have more users with cookies enabled. Consider using cookies, sessions, or the query string instead.