where-am-i/index.js


$(function()
{
	if(google.loader.ClientLocation)
	{
		
		var loc = google.loader.ClientLocation;

		if(loc.latitude)
		{
			var url = 'http://maps.google.com/maps?&z=13&ll='+loc.latitude+','+loc.longitude;
			var mapsLink = '<a href="'+url+'">'+url+'</a>';
			
			$('#output')
				.html('<pre>Latitude = '+loc.latitude+'\n'
					+ 'Longitude = '+loc.longitude+'</pre>')
				.append('<p>In a map: '+mapsLink+'</p>');
		}
		else
		{
			$('#output').text('somewhere... I give up...');
		}
	}
});