
function init()
{
	hasLoaded = true;
	showDiv(0);
	
	if (NUMBER_OF_PICTURES > 1)
	{
		document.getElementById(LOADING_DIV).style.display='none';
		document.getElementById(NAVBOX_DIV).style.display='block';
		document.getElementById(PICTURES_LINK_ID_PREFIX + currentPic).style.background = currentPicColor;
	}
	
	if (document.getElementById(THUMBNAILS_DIV))
	{
		document.getElementById(THUMBNAILS_DIV).style.display='block';
	}
}

function doBgColor()
{
	for(var i = 0; i < NUMBER_OF_PICTURES; i++)
	{
		document.getElementById(PICTURES_LINK_ID_PREFIX + i).style.background= unselectedColor;
	}
	document.getElementById(PICTURES_LINK_ID_PREFIX + currentPic).style.background= currentPicColor;
}

function doNextColor()
{
	document.getElementById(BACK_DIV).style.color = unselectedColor;
	if(currentPic < (NUMBER_OF_PICTURES - 1))
	{
		document.getElementById(NEXT_DIV).style.color = unselectedColor;
	}
	else
	{
		document.getElementById(NEXT_DIV).style.color = deadLinkColor;
	}
}

function doBackColor()
{
	document.getElementById(NEXT_DIV).style.color= unselectedColor;
	if(currentPic > 0)
	{
		document.getElementById(BACK_DIV).style.color= unselectedColor;
	}
	else
	{
		document.getElementById(BACK_DIV).style.color= deadLinkColor;
	}
}

function showDiv(nDiv)
{
	for(var i = 0; i < NUMBER_OF_PICTURES; i++)
	{
		if (NUMBER_OF_PICTURES > 1)
		{
			document.getElementById(PICTURES_LINK_ID_PREFIX + i).style.background= unselectedColor;
			document.getElementById(NEXT_DIV).style.color= unselectedColor;
			document.getElementById(BACK_DIV).style.color= unselectedColor;
		}
		
		var buttonid = i;
		var id = PICTURES_ID_PREFIX + i;
		var node = document.getElementById(id);
		if(node && i==nDiv)
		{
			node.style.display='block';
			node.style.visibility='visible';
			currentPic = i;
			
			if (NUMBER_OF_PICTURES > 1)
			{
				document.getElementById(PICTURES_LINK_ID_PREFIX + currentPic).style.background= currentPicColor;
			}
		}
		else if(node)
		{
			node.style.display='none';
			node.style.visibility='hidden';
		}
	}
}

function showDivNext()
{
	if(currentPic < (NUMBER_OF_PICTURES - 1))
	{
		showDiv(currentPic + 1);
		doBgColor();
		doNextColor();
	}
}

function showDivPrev()
{
	if(currentPic > 0)
	{
		showDiv(currentPic - 1);
		doBgColor();
		doBackColor();
	}
}

function ColorOver(o)
{
	o.style.backgroundColor= currentPicColor;
}

function ColorOut(o)
{
	o.style.backgroundColor= unselectedColor;
	document.getElementById(PICTURES_LINK_ID_PREFIX + currentPic).style.background= currentPicColor;
}

