     window.onload = getLocation;
     
     // FOR NON-LOGGED IN USER     
     function saveVisitorPosition(position){
		 $.ajax({
			 url: "/listings/getNearbyListings?latitude="+position.coords.latitude+"&longitude="+position.coords.longitude
		 });
		 $('[name=visitor_location_lat]').val(position.coords.latitude);
		 $('[name=visitor_location_lng]').val(position.coords.longitude);
	  }
			        
      function errorCallback(pos) { console.log("Error happened on geolocation.watchPosition!"); }
      function getLocation() {
          if (navigator.geolocation) {
            watchOpts = {
              enableHighAccuracy:true,
              timeout:60000,
              maximumAge:0
            };
            navigator.geolocation.watchPosition(saveVisitorPosition, errorCallback, watchOpts);
          } 
      }