var rotsNr = 0;
var rotsTimer;

function SwitchSplash(nr) // internal function
{
	var rotsurl = false;
	var rotsimg = false;

	if (document.getElementById)
	{
		rotsurl = document.getElementById('rotsurl');
		rotsimg = document.getElementById('rotsimg');
	}
	else if (document.all)
	{
		rotsurl = document.all['rotsurl'];
		rotsimg = document.all['rotsimg'];
	}
	else
	{
		return 0;
	}

	// ensure that the objects were successfully fetched
	if (!rotsurl || !rotsimg)
		return 0;

	// ensure that the attributes that we want to change exist
	if (!rotsurl.href || !rotsimg.src)
		return 0;

	// rotatingSplashes[nr][0] = link url
	// rotatingSplashes[nr][1] = image filename
	// rotatingSplashes[nr][2] = image alt text
	rotsurl.href = rotatingSplashes[nr][0];
	rotsimg.src  = rotatingSplashes[nr][1];
	rotsimg.alt  = rotatingSplashes[nr][2];

	rotsNr = nr;

	return 1;
}

function RotateSplashes()
{
	if (SwitchSplash((rotsNr + 1) % rotatingSplashes.length))
		rotsTimer = window.setTimeout(RotateSplashes, 5000);
}

if (rotatingSplashes.length)
{
	rotsTimer = window.setTimeout(RotateSplashes, 5000);
}

function csts(prefix) // Click STatistics for rotating Splashes
{
	cst(prefix + rotsNr);
}
