	var i=0;
	var json=0;
	var doPlay = true;
	var timeOutId = 0;
	$.ajax({  
	  url: "post/introlist.php",
	  cache: false,
	  success: function(html){
		  if (html) {
	   		json = eval('(' + html + ')');
			preLoadFirst();			
		  }
	  }		  
	});	
	
	function changeCarrouselImage(id)
	{
		for (x=1;x<=json.length;x++) {
			if (document.getElementById('car_' + x)) {
				document.getElementById('car_' + x).src = 'images/carrousel_out.jpg';
			}
			if (document.getElementById('car_' + id)) {
				document.getElementById('car_' + id).src = 'images/carrousel_in.jpg';
			}
			
		}
	}	
	
	function getInfo()
	{
		if (json && json[i].prent) {
			$("#carrousel_tekstbody").hide(1);
			if (json[i].titel && json[i].titel!='') {
				$("#carrousel_tekstbody").html(json[i].titel);
				$("#carrousel_tekstbody").show(300); 															
			}
			$("#foto").css({ backgroundImage: 'url("images/' + json[i].prent + '")'},500);			
			if (json[i].link && json[i].link!='') {
				$("#foto").html("<a href=\"" + json[i].link + "\"><img src=\"images/spacer.gif\" alt=\"\" width=\"100%\" height=\"97%\" border=\"0\" /></a>");		
			} else {
				$("#foto").html("<img src=\"images/spacer.gif\" alt=\"\" width=\"100%\" height=\"97%\" border=\"0\" />");						
			}
			s = parseInt(i)+1;
			changeCarrouselImage(s);			
			preloadNext();
			i=i+1;
		}
	}
	function switchBody()
	{
		if (!doPlay) return false;
		a = json.length;	
		if (a == 0) { return false; }
		if (i >= a && a > 1) { 
			i=0;
		} else if (i >= a && a == 1) {
			return false;
		}
		getInfo();
		startSwitch();
	}
	function startSwitch()
	{
		if (i==0) {
			setTimeout("switchBody()","100");
		} else {
			setTimeout("switchBody()","6000");
		}
	}
	function preLoadFirst()
	{
		if (i < json.length) {
			var image = new Image();
			image.src = json[i].prent;
		}	
		startSwitch();
	}
	
	function preloadNext() 
	{
		var volgende = i+1;
		if (volgende < json.length) {
			var imagee = new Image();
			imagee.src = json[volgende].prent;			
		}		
	}
	
	function holdon(id)
	{
		doPlay=true;
		i = parseInt(id)-1;
		switchBody();
		changeCarrouselImage(id);
		doPlay = false;			
	}
	

	

