/*
$(document).ready(function() {
    // AJAX GET initial count
    $("#document_count").load("/score/");
});
*/

function score(local_count) {
	// AJAX POST score
	$.post(SITE_ROOT+"score/", {
        count: parseInt(local_count)
	}, function(html) {
        $("#document_count").html(html + "");
    }, "raw");
}

function twitter(submitted_name,score) {
	
	var msg = (score > 50) ? "cheated at RoyalFail" : "got "+score+" items of post beyond the picket line at RoyalFail!"
	
	// AJAX POST name
	$.post(SITE_ROOT+"twitter/", {
        user : submitted_name
	}, function() {
		location.href = "http://twitter.com/?status="+escape("I just "+msg+". See how many you can get at http://theroyalfail.com!")
	});
	
}