$.fn.rated = function() {
    $(this).each(function() {
        // Get the value
        var val = parseFloat($(this).html());
        // Make sure that the value is in 0 - 5 range
        val = val > 5 ? 5 : (val < 0 ? 0 : val);
        // Calculate physical size
        var size = 16 * val;
        // Create stars holder
        var stars = $('<span class="rated"><span></span></span>');
        // Adjust yellow stars' width
        stars.find('span').width(size);
        // Replace the numerical value with stars
        $(this).replaceWith(stars);
    });
}
