function updateLocation(id){
	$("#results").html('<p align="center"><em>Loading City Data...</em></p>');
	$.ajax({
		url: 'ajax.php?call=location&id='+escape(id)+'',
		type: 'GET',
		dataType: 'html',
		success: function(html){
			$("#results").html(html);
		}
	});
}

function alertUser(){
	if(confirm("After you complete payment through PayPal, make sure you click 'Return To Merchant' after you're done!")){
		return true;
	}else{
		return false;
	}
}

function searchFor(lat,lon,range,query){
	$.getJSON('ajax.php?call=searchFor&lat='+escape(lat)+'&lon='+escape(lon)+'&dist='+escape(range)+'',
	function(data){
		$("#results_amount").html('Found <strong>'+data.results+' results!</strong>');
		$.each(data.cities,function(i,item) {
			var html = "<strong>"+item.city_name+", "+item.city_state+"</strong> - <em>"+item.city_zip+"</em><br /><strong>Latitude:</strong> "+item.city_lat+"<br /><strong>Longitude:</strong> "+item.city_lon+"<br /><strong><em>"+item.distance+" miles away from "+query+"</em></strong>";
			$('#map1').jmap('AddMarker',{
				'pointLatLng':[item.city_lat, item.city_lon],
				'pointHTML': html
			},function(marker){
				if(i == 0){
					$('#map1').jmap("MoveTo",{'mapCenter':[item.city_lat,item.city_lon],'mapZoom':11});
					marker.openInfoWindowHtml(html);
				}
			});
			
		});
	});
}