window.Geolocation = { current : function() { navigator.geolocation.getCurrentPosition( function(pos) {Geolocation.success(pos)}, function(err) {console.log(err.code);}, {highAccuracy:true, maximumAge:0, timeout:1000} ); }, watch : function() { navigator.geolocation.watchPosition( function(pos) {Geolocation.success(pos)} ); }, success : function(pos) { Geolocation.latitude = pos.coords.latitude; Geolocation.longitude = pos.coords.longitude; } };