"The mission of the Geolocation Working Group, part of the Ubiquitous Web Applications Activity, is to define a secure and privacy-sensitive interface for using client-side location information in location-aware Web applications."
Check if geolocation available:
if( !navigator.geolocation ){
Get current position, and when available call this function:
navigator.geolocation.getCurrentPosition(function(pos){
...
The rest is up to you!
Questions?