// util si ajax par ex pour �viter de dupliquer les events : sSelecteur = #id
function vote( sSelecteur) {
	sSelecteur = $defined( sSelecteur) ? sSelecteur + ' ' : '';
	$(sSelecteur + 'form :radio.star').rating({
		focus: function(value, link){
			if( ! this.disabled) {
				var tip = $('#help_' + this.id.replace(/(_\d+)$/, ''));
				tip[0].data = tip[0].data || tip.html();
				tip.html(link.title || value);
			}
		},
		blur: function(value, link){
			if( ! this.disabled) {
				var tip = $('#help_' + this.id.replace(/(_\d+)$/, ''));
				tip.html(tip[0].data || '');
			}
		},
		required: true
		
	});
	vote_resultat( sSelecteur);
}
function vote_resultat( sSelecteur) {
	sSelecteur = $defined( sSelecteur) ? sSelecteur + ' ' : '';
//	$(sSelecteur + '.vote_rating').each( function() {
//		if( ! $(this).data('rating')) {
//			$(this).hover( function() {
//				$(this).children('.vote_help:first').hide().next('.vote_help').show();
//			}, function() {
//				$(this).children('.vote_help:first').show().next('.vote_help').hide();
//			}).data('rating', true);
//		}
//	});
};

function poster(){
	$("#voter").click( function(value, link) {
		var jqForm = $(this.form),
			sData = jqForm.serialize();
		if( $(':hidden[name=type]', jqForm).val() != '1' ? test_ident() : true) {
			$(this).rating('disable');
			$.ajax({
				url: jqForm.attr('action') + '_ajax',
				type: 'post',
				data: sData,
				timeout: 10000,
				error: function( event, request, settings) { alert( constante( 'ajaxError'));},
				beforeSend: function() {
					$('.vote_help', jqForm).empty().addClass('ajaxloading_small ajax_star_rating');
				},
				success: function( data) {
					$('#donne_avis').html( data);
					vote_resultat();
				},
				complete: function() {
					$('.vote_help', jqForm).removeClass('ajaxloading_small ajax_star_rating');
				}
			});
		}
		return false;
	});
}