

$(document).ready(function(){ 
  $.ajax({
   type: "POST",
   url: "/do/lookup",
   data: {tag: $.trim($(".link_title_lookup_results").attr("id"))},
   success: function(data, status, jqXHR) {
      if(typeof data.code != 'undefined' && data.code === "1") {
//               $("div#shadowBox").hide();
//               $(".notify_found").hide();
//
//               // prevents double clicks. 
//               // no more submit till hte user types in the tag again 
//               // (why would they need to re lookup a link they are on anyway)
//               $("#lookupButton").attr('src', '/images/lookup_button_disabled.png');
//               $("#lookupButton").attr('disabled', 'disabled'); // money:    
         
         // attempt to get location
         if (geo_position_js.init()) {
           geo_position_js.getCurrentPosition(
             function(p){                    
               if(typeof data.info != 'undefined') {
                 data.info.longitude = p.coords.longitude;
                 data.info.latitude = p.coords.latitude;
                 
                 //this works
                  $.ajax({
                    type: "POST",
                    url: "/do/geoShare",
                    data: data.info,
                    success: function(data, status, jqXHR) {
                    //alert(data);
                    }
                  });
               }
//                       longitude = p.coords.longitude;
//                       latitude = p.coords.latitude;
               
               // update location here
               // must get lookup id, lbu id, lookup l idx, lbu l idx,
             }, 
             function(p){ 
               //alert("fail");
             
             });
         }
       }
     },
     complete: function() {
    	 //alert('now');
     }
  });    






/*
  
   // attempt to get location
   if ((typeof data != 'undefined') && geo_position_js.init()) {
     geo_position_js.getCurrentPosition(
       function(p){ 
           
           if(typeof data.info != 'undefined') {
               data.info.longitude = p.coords.longitude;
               data.info.latitude = p.coords.latitude;
               console.log('byah : ' + JSON.stringify(data.info));
               
               //this works
                $.ajax({
                     type: "POST",
                     url: "/do/geoShare",
                     data: data.info,
                     success: function(data, status, jqXHR) {
                         return;
                     }
                });
           }
//                       longitude = p.coords.longitude;
//                       latitude = p.coords.latitude;
         
         // update location here
         // must get lookup id, lbu id, lookup l idx, lbu l idx,
       }, 
       function(p){ 
         //alert("fail");
       
       });
   }
 */
});

