function isDeviceLocationAware()
{
if(typeof(navigator.geolocation) != 'undefined')return true;
if(typeof(google) != 'undefined'){
 if(typeof(google.gears) != 'undefined')return true;
}
return false;
}

function getDeviceLocation()
{
try{
  navigator.geolocation.getCurrentPosition(function(position){
   // success - geolocation authorized by user
   updateDeviceLocation ({lat:position.coords.latitude, lng:position.coords.longitude, accuracy: position.coords.accuracy});
   return;
  }, function(){
   // fail - geolocation denied by user
   updateDeviceLocation(null);
  });
}catch(e){
 try{
  var geo = google.gears.factory.create('beta.geolocation');
  geo.getCurrentPosition(function(position) {
   // success - geolocation authorized by user
   updateDeviceLocation({lat:position.latitude, lng:position.longitude, accuracy: position.accuracy});
   return;
  }, function(){
   // fail - geolocation denied by user
   updateDeviceLocation(null);
  });	
 }catch(e) {}
}
		
}

