
window.addEvent( 'load', function(){

		var barNum = $ES( '.honap' ).length;
		if(barNum > 0 ) {
		var barWidth = $ES( '.honap' )[0].getStyle('width').toInt();
		
		$('times').style.width = barNum * ( barWidth + 6 ) + 'px';

		var timesWidth = $('times').getStyle('width').toInt();
		
		// megadja, hogy hány kattintással tudunk végigmenni az időn :)
		
		var junit = timesWidth / 10;

		var currentScroll = ( notFirstRun ) ? $('timewrapper').getStyle('width').toInt() : 0;
		var notFirstRun = false;

		var scroll = new Fx.Scroll('timewrapper', {
			wait: false,
			duration: 1000,
			offset: {'x': 0, 'y': 0},
			transition: Fx.Transitions.Quad.easeInOut
		});

		$('arw_left').addEvent('mousedown', function(event) {
			event = new Event(event).stop();

			scroll.scrollTo( parseInt( currentScroll - junit ), 0 );
			currentScroll -= junit
			
			currentScroll = ( currentScroll < 0 ) ? $('timewrapper').getStyle('width').toInt() : currentScroll;
		});

		$('arw_rght').addEvent('mousedown', function(event) {
			event = new Event(event).stop();

			scroll.scrollTo( parseInt( currentScroll + junit ), 0 );
			currentScroll += junit

			currentScroll = ( currentScroll > timesWidth ) ? timesWidth : currentScroll;

		});
	}
} );
