/// <reference path="jquery-1.2.6.min.js" />

$(document).ready(function() {
var api = $("#kriz_box").scrollable({ horizontal: true, items: '.items', size: 1, loop: true });

	$('.steppers a').click(function(){
		clearTimeout(sid);
	});
	$('.navi span').click(function(){
		clearTimeout(sid);
	});
	
	var isPaused = false;
	var slideTime = 3000;
	var sid;
	var totalLength = api.scrollable().getStatus().total - 1;
	
	var i = 0;
	function autoScroll() {
	    api.scrollable().next();
		
		respawn();
		if (i == totalLength) {
			i = 0;
			api.scrollable().begin();
		}
		else {
			i++;
		}
	}
	function respawn() {
			sid = setTimeout(autoScroll, slideTime);
	}
	respawn();
});

