.. then check out these links:
http://www.ip2nation.com/ip2nation/Sample_Scripts
http://www.geobytes.com/geodirection.htm#AlternatePageName
And finally a real WordPress plugin:
http://geoposty.com/what-is-geoposty/
UPDATE 11th of July 2012:
This seems to be the best Geo-IP solution – free with javascript:
http://www.easyjquery.com/detect-get-clients-ip-address-country-using-javascript-php/
These have an API, but not too easy to use with javascript:
http://ipinfodb.com/ip_location_api_json.php
These too have a javascript, but with limitations (link or license)
http://www.maxmind.com/app/javascript
Explained here: http://www.superaffiliatetwins.com/free-geo-ip-javascript-campaigns/
Don’t expect high accuracy, unless you’re satisfied with country/city precision. It is after all IP based geolocation and in most cases that is limited to your ISP provided data records. Look at an IP location info webtool ( like http://geoipinfo.org/ ) and you’ll see approximately where it finds you, and it also provided accuracy at city and country levels – percentage wise.