//Previous-Next menu functions
var linksList = new Array();
var currItem = null;
var totalMenuWidth = null;
var previousButtonWidth = null;
var nextButtonWidth = null;

function addItemToLinksList(next)
{
	linksList.push(next);
}

//Finds the previous and next entries as well as deactivates the links and images if a next or previous isn't available.
function getPreviousAndNext(current)
{
	var i = 0;
	
	for(i = 0; i < linksList.length; i++)
	{
		if(linksList[i] == current)
			currItem = i;
	}
	
	if(currItem > 0)
		document.getElementById("previous-link").href = linksList[currItem-1];
	else
		document.getElementById("previous-link").style.background = "transparent url(/images/styles/previous-arrow-off.gif) no-repeat";
		
	if(linksList.length > 1 && (currItem != linksList.length - 1 || currItem == 0))
		document.getElementById("next-link").href = linksList[currItem + 1];
	else
		document.getElementById("next-link").style.background = "transparent url(/images/styles/next-arrow-off.gif) no-repeat";
}

function sizeMenu()
{
	totalMenuWidth = document.getElementById("previous-next-menu").clientWidth;
	nextButtonWidth = document.getElementById("next-link").clientWidth;
	previousButtonWidth = document.getElementById("previous-link").clientWidth;
	
	document.getElementById("middle-link").style.width = totalMenuWidth - previousButtonWidth - nextButtonWidth;
}
