		$(document).ready(function() {

			var index = 0;
			var indit;
			var tarolo = $('div.latest div.folio');
			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 * 629;
				var maxpos = $(tarolo).children().size() * 629;
				
				if (pos < maxpos) { pos = (index * -629); animido = 1500; } else { pos = 0;  animido = 2000;}
				
				$(tarolo).animate({ left: pos }, animido);
				
				indit = setInterval(function() { Kepvalt(next); }, valtido);
				
				$('ul.scroll li a').removeClass('active');
				var link = index + 1;
				$('ul.scroll li a#w' + link).attr('class', 'active');
				
			}
			
			indit = setInterval(function() { Kepvalt(next); }, valtido);
			
			$(tarolo).mouseover(function() { clearInterval(indit); }).mouseout(function() { indit = setInterval(function() { Kepvalt(next); }, 3000); });
			
			$('a#next').click(function () {
				clearInterval(indit);
				Kepvalt(next);
			});
			
			$('a#prev').click(function () {
				clearInterval(indit);
				Kepvalt(prev);
			});
			
			$('ul.scroll li a').click(function() {
				var href = $(this).attr("href").replace(/#klp/g, '');
				href--;
				Kepvalt(href);
			});
			
		});

