var curr_no = 1;
var timer_no = 1;
var rotate_timer = "";
var timer = 5000;
if(typeof(max_no) == "undefined"){
	alert("Voor de carousel dien je nog een maximaal aantal items in te stellen.");
}

function showItem(no){
	if(curr_no!=no){
		resetItems();
		$("#news_image_"+no).fadeIn();
		curr_no=no;
	}
}

function resetItems(){
	$("#news_image_"+curr_no).fadeOut();
}

function autoRotate(){
	showItem(timer_no);
	timer_no++;
	if(timer_no>max_no){
		timer_no=1;
	}
	rotate_timer=setTimeout("autoRotate()",timer);
}

function stopRotate(){
	if(typeof rotate_timer != 'undefined'){
		clearTimeout(rotate_timer);
	}
}
