var MoveDistance = 14.8;
var TimeLoop = 1;
var CurrentLeftMargin = 0;
var IconCount = 0;
var IconTotal = 0;
var ObjectDifference = 0;

function setIconTotal(s) {
	IconTotal = s;
}

function MoveTab(direction)
{
	ObjectWidth = getStyleObject("TabsContainer").width;
	ObjectWidth = ObjectWidth.replace("px","");

	if (direction == "Right")
	{
		ObjectDifference = ObjectWidth - (0 - (CurrentLeftMargin - MoveDistance));
		if((ObjectDifference >= 592) == true)
		{
			getStyleObject("TabsContainer").marginLeft = CurrentLeftMargin - MoveDistance + "px";
			CurrentLeftMargin = CurrentLeftMargin - MoveDistance;
		}
	}
	if (direction == "Left")
	{
		if ((CurrentLeftMargin + MoveDistance) <= 0)
		{
			ObjectDifference = ObjectWidth - (0 - (CurrentLeftMargin - MoveDistance));
			if(CurrentLeftMargin != 0)
			{
				getStyleObject("TabsContainer").marginLeft = CurrentLeftMargin + MoveDistance + "px";
				CurrentLeftMargin = CurrentLeftMargin + MoveDistance;
			}
		}
	}
}
function RepositionTab(direction)
{
	if (TimeLoop <= 10)
	{
		MoveTab(direction);
		setTimeout("RepositionTab('" + direction + "')",1);
	}

	if (TimeLoop == 11)
	{
		if (direction == "Right")
		{
			if((IconCount+1) <= (IconTotal - 4))
				IconCount++;
		}
		if (direction == "Left")
		{
			if ((IconCount-1) >= 0)
				IconCount--;
		}

		getStyleObject("TabsContainer").marginLeft = "-" + (148 * IconCount) + "px";
		SetupIcons(IconTotal,IconCount+1);
		TimeLoop = 0;
	}

	TimeLoop++;
}

function SetupIcons(IconCount,StartPosition)
{
	getObject("PressReleaseNavigation").innerHTML = "";
	for(i=IconCount; i > 0;i--)
	{
		if ((StartPosition <= i) && (StartPosition >= i-3))
			getObject("PressReleaseNavigation").innerHTML = '<img src="/images/WhiteFile.gif" width="12" height="15" />' + getObject("PressReleaseNavigation").innerHTML;
		else
			getObject("PressReleaseNavigation").innerHTML = '<img src="/images/BrownFile.gif" width="12" height="15" />' + getObject("PressReleaseNavigation").innerHTML;
	}
}


