var sXmlBanners = "banners.xml";	// Name of the XML file to load
xmlBanners = null;
/*
function OnLoadXml() // obsolete ... probably ...
{
	xmlBanners = LoadXMLDoc(sXmlBanners);

	var criterium, nodes = null, root = xmlBanners.documentElement;
	criterium = "Row" //"Row[ReleaseID='1']";
	nodes = root.selectNodes(criterium);
	
	if (nodes.length < 1) alert("No banners found!");
	else
	{
		document.all.nrDiv.innerHTML = "";
		title = new Array(3);
		image = new Array(3);
		txtDiv = new Array(3);
		time = new Array(3);
		
		for (var i=0; i<nodes.length; i++) {	
			title[i] = GetTagnameValue(nodes[i].getElementsByTagName("title"));	
			image[i] = GetTagnameValue(nodes[i].getElementsByTagName("image"));		
			txtDiv[i] = GetTagnameValue(nodes[i].getElementsByTagName("text"));		
			time[i] = GetTagnameValue(nodes[i].getElementsByTagName("time"));
		}
		startRotation();
	}
}
*/


function startRotation()
{
	document.all.nrDiv.innerHTML = "";	// Create dynamic numbered list
	for (var i=0; i<image.length; i++) 
	{	
		document.all.nrDiv.innerHTML += '<span id="imgNr'+i+'" onclick="stopRotation('+i+');" style="cursor:pointer;">&nbsp;<b>'+(i+1)+'</b></span>';
	}
	bannerRotate();
}

var image, title, txtDiv, time;
var count = 0;
var rotation = -1;
							
function bannerRotate() 
{
	if (rotation==-1)
	{
		if (count > image.length-1) count=0;
		document.getElementById("titleDiv").innerHTML = title[count];
		document.getElementById("imgDiv").innerHTML = image[count];
		document.getElementById("txtDiv").innerHTML = txtDiv[count];
		setColor(count);
		setTimeout("bannerRotate();", time[count]);
		count++;
	}
}

function stopRotation(nr)
{
	rotation = nr;
	document.getElementById("titleDiv").innerHTML = title[rotation];
	document.getElementById("imgDiv").innerHTML = image[rotation];
	document.getElementById("txtDiv").innerHTML = txtDiv[rotation];
	setColor(nr);
}

function setColor(nr)
{
	for (var i=0; i<image.length; i++)
	{
		document.getElementById("imgNr"+i).style.color="#999999";
	}
	document.getElementById("imgNr"+nr).style.color="#009966";
}
