var expandID = 255;
var controlsPostion = 640;

var expandLock = false;
var currentSpotlightMini = 0;
var expandSLWidth = 0;

var currentSpotlight = 1;
var nextSpotlightID = 200;

var transitionSpeed = 8000; // 8 seconds

function homepageOnLoad()
{
	initSpotlight();
}

function initSpotlight()
{
	jQuery("#spotlight2").fadeOut(0);
	jQuery("#spotlight3").fadeOut(0);
	jQuery("#spotlight4").fadeOut(0);
	nextSpotlightID = setTimeout("nextSpotlight()", transitionSpeed);
}

function userClick(index)
{
	if(index == currentSpotlight)
	{
		return;
	}
	
	jQuery(".spotlight").stop(true, true).fadeOut(2000);

	clearTimeout(nextSpotlightID);
	nextSpotlightID = setTimeout("nextSpotlight()", transitionSpeed);
	setSpotlight(index);
}

function setSpotlight(index)
{
	var control = "control" + currentSpotlight;
	var spotlight = "spotlight" + currentSpotlight;

	jQuery("#" + spotlight).fadeOut(2000);
	//opacity(spotlight, 100, 0, 1000);

	if(currentSpotlight != 0)
	{
		document.getElementById(control).className = "";
	}
	//document.getElementById(spotlight).className = "hide";
	
	control = "control" + index;
	spotlight = "spotlight" + index;

	if(index != 0)
	{
		document.getElementById(control).className = "highlight";
	}
	//document.getElementById(spotlight).className = "show";		

	jQuery("#" + spotlight).fadeIn(2000);
	//opacity(spotlight, 0, 100, 2000);

	currentSpotlight = index;
}

function nextSpotlight()
{
	if(currentSpotlight == 4)
	{
		setSpotlight(1);
	}
	else
	{
		setSpotlight(currentSpotlight + 1);
	}
	nextSpotlightID = setTimeout("nextSpotlight()", transitionSpeed);
}