function addVideoRating( url, video_id )
{
	jQuery('fieldset[class=starrating] a').click(function(){
		var value = jQuery(this).attr( 'value' );

		jQuery('fieldset[class=starrating] a:not([value='+ value +'])').removeClass( 'current-rating' );
		jQuery(this).addClass( 'current-rating' );

		jQuery.ajax({
			url			: url,
			data		: {
				'id'			: video_id,
				'rating'		: value,
				'from_player' 	: 0
			},
			type		: 'POST',
			dataType	: 'html',
			beforeSend	: function( XMLHttpRequest ) {
				jQuery('fieldset[class=starrating] ul li').hide();
				jQuery('fieldset[class=starrating] ul').append( jQuery('<li>').addClass( 'loading' ).fadeTo( 'fast', 0.75 ) );
			},
			complete	: function( XMLHttpRequest, textStatus ) {
				jQuery('fieldset[class=starrating] ul li[class=loading]').fadeOut('slow').remove();
				jQuery('fieldset[class=starrating] ul li').show();
			},
			error		: function( XMLHttpRequest, textStatus, errorThrown ) {
				console.log( 'Unexpected Error: '+ textStatus )
			},
			success		: function( data, textStatus ) {
				var message = jQuery(data).find('mensaje').html();
				var total	= jQuery(data).find('totalVotos').html();
				var average	= jQuery(data).find('puntos').html();

				jQuery('fieldset[class=starrating] legend').html( 'Valoraci&oacute;n: '+ average +'/10 ('+ total +' votos) - '+ message );
			}
		});
	});
}
