function mouseOutF() 
{
	pos = $(this).attr('alt')+'px 0px';
	$(this).css('backgroundPosition', pos);
}

jQuery.fn.DeseoVote = function(counter, width) {

	
	def_value = $(this).attr('value');
	if(def_value=='') def_value = '';

	name = this.attr('id');

	var $container = jQuery(this);

	html = '<input type="hidden" value="'+def_value+'" name="'+name+'" />';


	for(ss=0; ss<counter; ss++)
	{
		pos = -ss*width;
		value = ss+1;
		
		myClass = '';
		if(ss==counter+1) myClass='rt_last';

		html += '<div class="DeseoVoteObj '+myClass+'" style="background-position: '+pos+'px 0px" alt="'+pos+'" value="'+value+'"></div>';
	}


	this.html(html);

	$(this).children('.DeseoVoteObj').mouseover(function() {
		pos = $(this).attr('alt')+'px 100%';
		$(this).css('backgroundPosition', pos);
	});

	$(this).children('.DeseoVoteObj').bind('mouseout', mouseOutF);

	$(this).children('.DeseoVoteObj').click(function() {
		
		$container.children('input').val($(this).attr('value'));

		$container.children('.DeseoVoteObj').each(function() {
			pos = $(this).attr('alt')+'px 0px';
			$(this).css('backgroundPosition', pos);
			$(this).bind('mouseout', mouseOutF);
		});

		pos = $(this).attr('alt')+'px 100%';
		$(this).css('backgroundPosition', pos).unbind('mouseout');
	});
	def_value--;
	pos = (-def_value*width)+'px 100%';

	$(this).children('.DeseoVoteObj').eq(def_value).css('backgroundPosition', pos).unbind('mouseout');


}
