function fivestar(id, token, ts) {
    $("#fivestar-form-"+id).children().not("select").hide();

    // Create stars for: Rate this
    $("#fivestar-form-"+id).stars({
        cancelShow: 0,
        cancelValue: 0,
        captionEl: $("#caption"),
        callback: function(ui, type, value)
        {
            // Disable Stars while AJAX connection is active
            ui.disable();

            $("#fivestar-loader-"+id).show();
			$("#fivestar-form-"+id).hide();
			
            $.post("/action/fivestar/rate", {id: id, vote: value, __elgg_token: token, __elgg_ts: ts}, function(db)
            {
                $("#fivestar-form-"+id).stars("select", Math.round(db.rating));
                $("#fivestar-votes-"+id).text(db.votes);
                $("#fivestar-rating-"+id).text(db.rating);

                $("#fivestar-form-"+id).show();
                $("#fivestar-loader-"+id).hide();
            }, "json");
    	}
    });

    // Create element to use for confirmation messages
    $('<div class="fivestar-messages" id="fivestar-messages-'+id+'"/>').appendTo("#fivestar-form-"+id);
};