/*var total = 3;
var times = 0;
var current;
var count = 0;
var prev;

$(document).everyTime(4000, function(i)
{
	fadeDiv(i);
});

function fadeDiv(id)
{
	count++;
	if (id < 4)
	{
		current = id;
		prev = id - 1;
	}
	else
	{
		if (count > total)
		{
			times++;
			prev = total;
			current = id - (total * times);
			count = 1;
		}
		else
		{
			current = id - (total * times);
			prev = current - 1;
		}
	}
 	$("#spon_" + current).fadeIn("slow");
	$("#spon_" + prev).fadeOut("slow");
}*/

var timeOut = 5000;
var fadeSpeed = 1000;

$(document).ready(function()
{
	showSponsoren(1);
});

// Sponsoren fade loop
function showSponsoren (number)
{
	if (document.getElementById("spon_holder") != null)
	{
		if (number > document.getElementById("spon_holder").getElementsByTagName("div").length)
		{
			number = 1;
		}
		$('#spon_' + number).fadeIn
		(
			fadeSpeed,
			function ()
			{
				setTimeout(function()
				{
					$('#spon_' + number).fadeOut(fadeSpeed,
					function ()
					{
						// Animation complete
						showSponsoren(number + 1);
					})
				},timeOut);
			}
		);
	}
}

