$(document).ready(function() {
	
	
	// initialize scrollable together with the circular plugin 
	//$("#infinite").scrollable().circular();
	

	
	// Option carto fiche
	//$('.googleOptions div:even', this).addClass('pair');
	
	$(".notation").mouseout(function()
	{
		positionVelo($(".nbrQuestion").val());
	});
	
});
	
	function IsNumeric(input)
	{
    	var RE = /^\d+$/;
    	return (RE.test(input));
	}
	
	function positionVelo(item, index)
	{
			
		$("#"+item).children().removeClass("active");
		//alert('note='+index);
		if(index!=0)
		{
			for( i=0; i <= index; i++)
			{
				if(i==0){
					var paramIndice='a:eq(0)';
				}
				else{
					var paramIndice="a:eq(" + i + ")";
				}
				$("#"+item).children(paramIndice).addClass("active");
			}
		}
	}
	
	function overOnCycle(item, index)
	{
		positionVelo(item, index);
		
		return false;
	}
	
	function poll_submit($id, $is_logged_in, $obj)
	{
		
		if($is_logged_in == '1')
		{
			if ( IsNumeric($obj.attr('rel') ) )
			{
				var $note = $obj.attr('rel');
				//alert($id + '-' + $is_logged_in + '-' + $note);
				$("#nbrQuestion_" + $id).attr('value', ($note-1));
				positionVelo("velo_" + ($id-1), $note);
				var $poll_button = "#poll_" + $id;
				$($poll_button).click();
			}
		}
		else
		{
			$('.notation').hide();
			$('.need_be_logged').show("slow");
		}	
		return false;
	}
	
	
	



