var spotlight_pointer = 3;

var spotlight_position = 1;

var spotlights = new Array(
'web-design',
'custom-software-development',
'alpha-ebusiness',
'joomla',
'ecommerce',
'online-marketing',
'hosting',
'intranets-and-extranets',
'data-management-systems',
'consulting');

setTimeout('replace_spotlight();', 3000);

function replace_spotlight()
{
	hide_spotlight(spotlight_position);
		
	setTimeout('replace_image('+spotlight_position+', '+spotlight_pointer+');', 1100);
	setTimeout('show_spotlight('+spotlight_position+');', 1300);
	
	spotlight_position++;
	if (spotlight_position > 3) spotlight_position = 1;
	
	spotlight_pointer++;
	if (spotlight_pointer >= spotlights.length) spotlight_pointer = 0;
	
	setTimeout('replace_spotlight();', 4000);
}

function replace_image(position, pointer)
{
	var container = document.getElementById("spotlight"+position);
	var hidden_spotlights = document.getElementById("hidden_spotlights");

	var new_spotlight = document.getElementById("spotlight_"+spotlights[pointer]);

	for (var i in container.childNodes)
	{
		if (typeof(container.childNodes[i]) != 'undefined' && typeof(container.childNodes[i].nodeName) != 'undefined')
		{
			if (container.childNodes[i].nodeName.toLowerCase() == 'a')
			{
				var old_spotlight = container.childNodes[i];
			}
		}
	}
	
	hidden_spotlights.appendChild(old_spotlight);
	container.appendChild(new_spotlight);
}

function show_spotlight(position)
{
	var container = document.getElementById("spotlight"+position);

	var anim = new YAHOO.util.Anim(container, {opacity:{from:0,to:1}}, 1, YAHOO.util.Easing.easeIn);
	anim.animate();
}

function hide_spotlight(position)
{
	var container = document.getElementById("spotlight"+position);

	var anim = new YAHOO.util.Anim(container, {opacity:{from:1,to:0}}, 1, YAHOO.util.Easing.easeIn);
	anim.animate();
}