function setPicture(username, numvotes, average) {
  document.getElementById("picture").innerHTML="<center><b>" + username + "</b><br>Rating: " + average + "</center><br>" +  "<img src=\"wasted/" + username + ".jpg\" />";
}

function vote(user_id, v) {
	var oldhtml = $('#vote').html();
	$('#vote').empty();
	$('#vote').html('<img style="margin: 0px 130px;" src="/img/ajax-loader.gif" />');
	$.ajax({
		url: "vote.php",
		dataType: 'json',
		data: "vote=" + v + "&user_id=" + user_id,
		complete: function(jqXHR, status) {
			$('#vote').empty();
			if(1 || status == 'success') {
				$('#vote').html('Thanks for the vote!');
			}
			else {
				$('#vote').html(oldhtml);
				alert('There was a problem voting, please try again.');
			}
		}
	});
}
