		// Written by Zoltan Hosszu (http://www.zoltanhosszu.com/)
		// All rights reserved.

		$(document).ready(function() {

			var index = 0;
			var indit;
			var tarolo = $('div.aktualis div.blocks');
			var next = index + 1;
			var prev = $(tarolo).children().size() - 1;
			var valtido = 8000;
			var animido;
			
			function Kepvalt(index) {
				clearInterval(indit);
				
				if (index >= $(tarolo).children().size()) {
					index = 0;
					next = index + 1;
					prev = $(tarolo).children().size() - 1;
				} else {
					if (index < 0) { index = $(tarolo).children().size() - 1; }
					prev = index - 1;
					next = index + 1;
				}
				
				
				var pos = index * 335;
				var maxpos = $(tarolo).children().size() * 335;
				
				if (pos < maxpos) { pos = (index * -335); animido = 1000; } else { pos = 0;  animido = 2000;}
				
				$(tarolo).animate({ left: pos }, animido);
				
				indit = setInterval(function() { Kepvalt(next); }, valtido);
				
				
				$('div.scroller ul li a').removeClass('active');
				var link = index + 1;
				$('div.scroller ul a#akt' + link).attr('class', 'active');
				
			}
			
			indit = setInterval(function() { Kepvalt(next); }, valtido);
			
			$(tarolo).mouseover(function() { clearInterval(indit); }).mouseout(function() { indit = setInterval(function() { Kepvalt(next); }, 3000); });
			
			$('div.scroller ul li a').click(function() {
				var href = $(this).attr("href").replace(/#a/g, '');
				href--;
				Kepvalt(href);
			});
			
		});
