	$(function(){

		 $('.hover-star').rating({
		  focus: function(value, link){
		    // 'this' is the hidden form element holding the current value
		    // 'value' is the value selected
		    // 'element' points to the link element that received the click.
		    var tip = $('#hover-test');
		    tip[0].data = tip[0].data || tip.html();
		    tip.html(link.title || 'value: '+value);
		  },
		  blur: function(value, link){
		    var tip = $('#hover-test');
		    $('#hover-test').html(tip[0].data || '');
		  }
		 });

		 $('.hover-star').click(function(){

		 	pieces = $(this).attr('id').split('_');
		 	newsId = pieces[0];
		 	userRate = pieces[1];

		 	$("#rate").block({ message: '<h1>Por favor aguarde...</h1>' });

			$.ajax({

				type: "POST",
				url: "/ratings/rate/" ,
				data:  "news_id=" + newsId +
				       "&rate="   + userRate ,
			  	cache: false,
			  	success: function(html){
			  		$("#rate").unblock();
			  		$("#rate").html(html);
				}

			})

		 });

	});