function nearby(stype){
var latlon = map.getCenter().lat()+','+map.getCenter().lng();
$.getJSON("./nearby.php",{ll: latlon, type: stype, ajax: 'true'}, function(j){
var options = '';
if (j.optionCount>0){
var surl = j.optionUrl; 
options = '<a href="javascript:hide(\'nearby_dsp\')">[X]</a> - <b>Click to See:</b><br />';
for (var i = 0; i < j.results.length; i++) {
options += '<a href="javascript:nearby_lu(\'' + surl +'?id='+j.results[i].optionValue+'\',\''+stype+'\');">' + j.results[i].optionDisplay + ' - ('+j.results[i].optionDist+'nm @ '+j.results[i].optionHdg+'&deg;)</a><br />';
}
} else {
options = '<a href="javascript:hide(\'nearby_dsp\')">[X]</a> - No Results within 60 miles, please try again from a different map location.';
}
$("#nearby_dsp").html(options);
show("nearby_dsp");
});     
}

function nearby_lu(surl,stype){
$.get(surl,function(data){
 $("#nearby_dsp").html('<a href="javascript:hide(\'nearby_dsp\')">[X]</a> - '+
                       '<a href="javascript:nearby(\''+stype+'\')">Back to List</a><br /><br />'+data);
});

}

