mScroller = Class.create({
	current_slide : 1,
	num_slides : 0,
	initialize: function(id) {
		this.id = id;
		$j('#'+this.id+' .movies-list ul').width(this.count_links() * 135);
		this.make_top_links();
		
		
	},
	count_links : function(){
		return $j('#'+this.id+' .movies-list li').size();
	}, 
	make_top_links : function() {
		var self = this;
		var nl = Math.floor( this.count_links() / 6 );
		this.num_slides = (nl > 0) ? nl : 1;
		
		$j('#'+this.id+' .nav li.left_arrow').click(function () { self.prevSlide(); });
		$j('#'+this.id+' .nav li.right_arrow').click(function () { self.nextSlide(); });
		
		$j('#'+this.id+' .nav li.nav_dot').hide();
		$j('#'+this.id+' .nav li.nav_dot').each(function(i, obj){
			if(i > nl)
				return;
			$j(obj).show();
			$j(obj).click(function () { 
				self.showSlide(i+1); 
			});
			 
		});
		
	},
	nextSlide: function(){
		if(this.current_slide >= this.num_slides)
			this.current_slide = 1;
		else
			this.current_slide++;
		this.showSlide(this.current_slide);

	},
	prevSlide: function(){
		if(this.current_slide <= 1)
			this.current_slide = this.num_slides;
		else
			this.current_slide--;
		this.showSlide(this.current_slide);

	},
	showSlide: function(index){
		this.current_slide = index;
		$j('#'+this.id+' .movies-list ul').animate({ 
			'left' : '-' + (132 * 6 * (index - 1)) + 'px'
		}, 400);
		$j('#'+this.id+' .nav li.nav_dot').removeClass('active');
		$j('#'+this.id+' .nav li.nav_dot:eq(' + (index - 1) + ')').addClass('active');
	}
});