Hey, I would recommend you use MaxMind, if you unser the following codeinto your page you will have access to a lot of info.
If you visit the actual script page over at http://j.maxmind.com/app/geoip.js , you will see that it creates some functions for you to use. There are other ways to do it, but I find MaxMind has the most comprehensive database of IP addresses.
Just bear in mind that unless you pay for a service, getting this IP info will always be a little risky, because of things like accidentally picking up on an ISP’s server IP or something along those lines.
Good luck with it anyway!