// 20080901 - Handles post ratings -wK

function post_rate(post_id, rating) {
	var xhr = new XHConn();
	var message = "";

	if (!xhr) {
		post_rating_feedback(post_id, "Error (1)");
	} else {
		post_rating_feedback(post_id, "Submitting..");
		var callback = function (x) { post_rating_feedback(post_id, x.responseText); };
		xhr.connect(
			"/rate.php",
			"POST",
			"post_id=" + post_id + "&rating=" + rating,
			callback);
	}
}

function post_rating_feedback(post_id, message) {
	e = document.getElementById("rate_" + post_id);
	if (e)
		e.innerHTML = message;
}
