/*
	Created by Les Argonautes - 01/06/2009
	http://www.les-argonautes.com
	Working with Mootools 1.2

*/

function voteSerie() {
	var vote_id = $('vote_id').get('value');
	var vote_value = this.getElement('span').get('text').toInt();
	var ajax = new Request.HTML({
		method: 'post',  
		url: '/action/note/',  
		update: $('serie_vote_stars').addClass('done')
		}).send('vote_value='+vote_value+'&vote_id='+vote_id);
}

window.addEvent('domready',function() {
	// Add event function on stars hover
	if($('serie_vote_stars').hasClass('done')==false) {
		$$('#serie_vote_stars a').each(function(item) {
			item.addEvents({
				'mouseover':function() {
					item.getAllPrevious().addClass('hover');
					item.addClass('hover');
				},
				'mouseout':function() {
					item.getAllPrevious().removeClass('hover');
					item.removeClass('hover');
				},
				'click':voteSerie
			});
		});
	}
});