var winners = function(){
	this.init();
}

winners.prototype = {
	init: function(){
		this.winners_list = $('#winners_list');
		this.slider = this.winners_list.find('ul');
		this.winners_items = this.slider.find('li');
		this.prev = this.winners_list.find('.prev').addClass('prev_disabled');
		this.next = this.winners_list.find('.next');
		
		this.winners_amount = this.winners_items.size();
		
		var i = 0;
		
		var that = this;
		
		this.next.click(function(){
			if( (i+3) < that.winners_amount ){
				i++;
				that.slider.animate({left: -33*i + '%'});
				that.prev.removeClass('prev_disabled');

				if( (i+3) < that.winners_amount ){
					$(this).removeClass('next_disabled');
				} else {
					$(this).addClass('next_disabled');
				}
			}
		});

		this.prev.click(function(){
			if( i > 0 ){
				i--;
				that.slider.animate({left: -33*i + '%'});
				that.next.removeClass('next_disabled');
				
				if( i > 0 ){
					$(this).removeClass('prev_disabled');
				} else {
					$(this).addClass('prev_disabled');
				}
			}
		});
		
		if( $.browser.msie && $.browser.version == 6 ){
			this.prev.hover(
				function(){ $(this).addClass('prev_hover'); },
				function(){ $(this).removeClass('prev_hover'); }
			);
			
			this.next.hover(
				function(){ $(this).addClass('next_hover'); },
				function(){ $(this).removeClass('next_hover'); }
			);
		}
	}
}

$(function(){
	new winners();
});
