The script only does something the first time you view it. It adds a cookie, then sends you to the other site. From then on it sees that you have a cookie already and does nothing
The real question is how this is happening in the first place. It's not being appended with JavaScript, because it's there even if I get the page with plain old wget. This sounds almost like they somehow edited the site's PHP source :-S
EDIT: Alright, everyone is safe. The site it redirects you to further redirects you to "QoogleSearch.com", which has been de-listed:
Domain Name: QOOGLESEARCH.COM
Registrar: GODADDY.COM, INC.
Whois Server: whois.godaddy.com
Referral URL:
http://registrar.godaddy.com Name Server: NS1.SUSPENDED-FOR.SPAM-AND-ABUSE.COM
Name Server: NS2.SUSPENDED-FOR.SPAM-AND-ABUSE.COM
Status: ok
Updated Date: 27-apr-2010
Creation Date: 21-jan-2010
Expiration Date: 21-jan-2011