jQuery(function(){
	jQuery("td:first, th:first", "table.rated-table tr").addClass("first");
	jQuery("td:last, th:last", "table.rated-table tr").addClass("last");
	
	/**
	 * Strength 
	 */
	jQuery(".strength").each(function(){
		var n = jQuery(this).text();
		try {
			n = (n < 1) ? 1 : (n > 5) ? 5 : n;
			n = Math.round(n);
			var bpg = -((n - 1) * jQuery(this).height());
			jQuery(this).css("background-position", "0 " + bpg + "px").attr("title", n);
		} catch (e) {
			console.log("Exception: Strength not digit!");
		}
	});
	
	/**
	 * Result 
	 */
	jQuery(".result span, .rating span").each(function(){
		var n = jQuery(this).text();
		try {
			n = (n < 1) ? 1 : (n > 5) ? 5 : n;
			var bpg = n * 20;
			jQuery(this).css("width", bpg + "%").attr("title", n);
		} catch (e) {
			console.log("Exception: Result not digit!");
		}
	});
})

