Here is a Java IP (InetAddress) Locator from SourceForge
Java and ColdFusion libraries to lookup country code and language from IP address. It uses a local copy of the WHOIS database to perform fast, accurate lookups of country codes. Useful for log analysis, internationalization, geolocation, etc..
http://sourceforge.net/projects/javainetlocator/
How about taking the variables from the script and passing them to a php file to process the reffer site. Most people have java turned on, you would only miss out on private servers. And why not set a cookie so when they return you can process them.