//Modified version of stars.js file to allow textual display of levels for users without JavaScript

$.fn.stars = function() {
    return $(this).each(function() {
        // Get the level
        var level = $(this).html();
		if (level == "Novice")
			{
				var val = 1;
			}
		else if (level == "Intermediate")
			{
				var val = 2;
			}
			
		else if (level == "Advanced")
			{
				var val = 3;
			}
        // Make sure that the value is in 0 - 5 range, multiply to get width
        var size = Math.max(0, (Math.min(3, val))) * 16;
		
		//Applies class for background holder with CSS
		$("span.wrap").addClass("stars");
		$("span.wrap").removeClass("wrap");
        // Create stars holder
        var $span = $('<span />').width(size);
        // Replace the numerical value with stars
        $(this).html($span);
    });
}

$(function() {
    $('span.wrap').stars();
});
