$(document).ready(function() {
	$('.rating-PushButton-unselected').mouseenter(function() {
		$(this).addClass("rating-PushButton-selected")
		$(this).prevAll().addClass("rating-PushButton-selected");
	});
	$('.rating-PushButton-unselected').mouseleave(function() {
		$(this).removeClass("rating-PushButton-selected")
		$(this).prevAll().removeClass("rating-PushButton-selected");
	});
	$('div[id|=rate]').mouseleave(function() {
		var hiddenEl = $(this).children()[0];
		var hiddenValue = $(hiddenEl).val();

		$(hiddenEl).siblings().each(function() {
			var thisValue = $(this).attr('value');
			if (hiddenValue == "" || hiddenValue < thisValue) {
				$(this).removeClass("rating-PushButton-selected")
			}
			else {
				$(this).addClass("rating-PushButton-selected")
			}
		});
	});
	
	$('.rating-PushButton-unselected').click(function() {
		var hiddenEl = $(this).parent().children()[0];
		$(hiddenEl).val($(this).attr('value'));
	});
})




