function ActivateHomeTabs(id) 
{
	var thedivs = getElementsByClassName(document,'div','CenterColTab');
	for(i = 0; i < thedivs.length; i++)
		thedivs[i].style.display = 'none';
	document.getElementById(id).style.display = 'block';

	var thedivs = getElementsByClassName(document,'img','CenterColButtons');
	for(i = 0; i < thedivs.length; i++)
		thedivs[i].style.display = 'none';
	document.getElementById(id+'_button').style.display = 'block';
}

function ActivateLeftTabs(id) 
{
	var thedivs = getElementsByClassName(document,'div','LeftColTab');
	for(i = 0; i < thedivs.length; i++)
		thedivs[i].style.display = 'none';
	document.getElementById(id).style.display = 'block';

	var thedivs = getElementsByClassName(document,'img','LeftColButtons');
	for(i = 0; i < thedivs.length; i++)
		thedivs[i].style.display = 'none';
	document.getElementById(id+'_button').style.display = 'block';
}

function clearBG(id)
{
	document.getElementById(id).style.background = "#ffffff";	
}

function getElementsByClassName(oElm, strTagName, strClassName)
{
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++)
	{
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className))
		{
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function ActivateStory(storyNum)
{
	current_story = storyNum;
	//change main story

	for(i=1; i<=num_rotate; i++)
	{
		if(i == storyNum)
		{
			document.getElementById('MainStoryImageContainer_' + i).style.display = 'block';
			document.getElementById('MainStoryTextContainer_' + i).style.display = 'block';
			document.getElementById('SubStoryImage_' + i).style.padding = '0px 0px 0px 0px';
			document.getElementById('SubStoryImage_' + i).style.border = '2px solid #05446F';
			document.getElementById('SubArrow_' + i).style.display = 'block';
			//document.getElementById('SubStoryImageContainer_' + i).style.display = 'none';
		}
		else
		{
			document.getElementById('MainStoryImageContainer_' + i).style.display = 'none';	
			document.getElementById('MainStoryTextContainer_' + i).style.display = 'none';	
			document.getElementById('SubStoryImage_' + i).style.border = '0px';
			document.getElementById('SubStoryImage_' + i).style.padding = '2px 2px 2px 2px';
			document.getElementById('SubArrow_' + i).style.display = 'none';
			//document.getElementById('SubStoryImageContainer_' + i).style.display = 'block';	
		}
	}
}

function RotateUp(storyNum)
{
	rotate_status = 0; //stop rotation
	if(current_story < num_rotate)
		ActivateStory(current_story + 1);	
	else
		ActivateStory(1);	
}

function RotateDown(storyNum)
{
	rotate_status = 0; //stop rotation
	if(current_story == 1)
		ActivateStory(num_rotate);	
	else
		ActivateStory(current_story - 1);	
}

function PauseRotation()
{
	rotate_status = 0; //stop rotation
}

function RotateStory()
{
	if(rotate_status == 1)
	{
		RotateAuto(current_story);
		var t=setTimeout("RotateStory()",rotate_num);
	}
	else {/*do nothing*/}
}

function RotateAuto(storyNum)
{
	if(current_story == num_rotate)
		ActivateStory(1);	
	else
		ActivateStory(current_story + 1);	
}