window.TopKarusel = {

	block : 'top_karusel',
	onePos : 227,
	duration : 100,
	pos : 1,
	maxPos : 2,
	count: 4,

	next : function(e, event){

		var duration = this.duration;
		var current_pos = this.pos * this.onePos;
		current_pos = -current_pos;
		
		this.pos ++;
		if(this.pos > this.maxPos) {
			this.pos = 1;
			current_pos = 0;
			duration = 0;
		}


		this.block.set('tween', {duration: duration, transition: Fx.Transitions.linear});
		this.block.tween('left', current_pos);
		
		return false;
	},

	prev : function(e){
		var duration = this.duration;
		
		this.pos --;
		
		var after_pos = this.pos-1;
		if(this.pos == 0 ) {
			this.pos = this.maxPos;
			duration = 0;
			var after_pos = this.pos - 1;
		}
		var current_pos = after_pos * this.onePos;
		current_pos = -current_pos;
		this.block.set('tween', {duration: duration, transition: Fx.Transitions.linear});
		this.block.tween('left', current_pos);

		return false;
	},

	init : function(){
		var hp_kis = $('top_karusel').getElements('a[rel="hp_ki"]');
		this.maxPos = hp_kis.length - this.count + 1;
		this.block = $('top_karusel');
	}
};
