var curr_no = 1;
var timer_no = 1;
var rotate_timer = "";
var timer = 5000;
var max_no = 3;
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();
		/* Afbeelding animaties */
		var currentIMG = $("#news_image_"+curr_no);
		var nextIMG = $("#news_image_"+no);
		nextIMG.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
		currentIMG.animate({opacity: 0.0}, 1000).removeClass('show');
		//
		/* Tekst animaties */
		var currentTXT = $("#news_text_"+curr_no);
		var nextTXT = $("#news_text_"+no);
		nextTXT.css({display: "none"}).addClass('show').show();
		currentTXT.hide().removeClass('show');
		//
		/* Class voor de knoppen */
		$("a#ss"+no).addClass("aan");
		curr_no=no;
	}
}
//
function resetItems(){
	$("a#ss"+curr_no).removeClass("aan");
}
//
function autoRotate(){
	/* CSS voor de afbeeldingen */
	$('#grote_afb a').css({opacity: 0.0});
	$('#grote_afb a.show').css({opacity: 1.0});
	//
	/* CSS voor de teksten */
	$('#nieuws_info a').css({display: "none"});
	$('#nieuws_info a.show').css({display: "block"});
	//
	/* Start de slideshow */
	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);
	}
}
