// JavaScript Document

var nextAction = new Array();

function loginBoxOpen()
		{
			nextAction['memLoginBox']='startLoginBoxTimer';
			slidedown('memLoginBox');
		}

var timeoutLoginBoxId;
var rotateTabsTimeOut;
var nextTab="";

function setUpRotateTabs()
	{
		// show current
		var box=document.getElementById(currentTab);
		if(box.style.display=='none') box.style.display='block';
		if(rotateTabsTimeOut != null)
	  {
	    clearTimeout(rotateTabsTimeOut);
	  }
	  rotateTabsTimeOut = setTimeout("rotateTabs();", 20000);
	}
	
function rotateTabs()
	{
		if(currentTab=='SP') nextTab='GTM';
		if(currentTab=='GTM') nextTab='HP';
		if(currentTab=='HP') nextTab='SP';
		nextAction[currentTab]='openNextTab';
		slideup(currentTab);
		
		if(rotateTabsTimeOut != null)
	  {
	    clearTimeout(rotateTabsTimeOut);
	  }
	  rotateTabsTimeOut = setTimeout("rotateTabs();",20000);
	}

function openTab(tab)
	{
		if(tab!=currentTab)
		{
		nextTab=tab;
		nextAction[currentTab]='openNextTab';
		slideup(currentTab);
		}
		if(rotateTabsTimeOut != null)
	  {
	    clearTimeout(rotateTabsTimeOut);
	  }
	  rotateTabsTimeOut = setTimeout("rotateTabs();",45000);
	}

function processNextAction(objname)
{
	if(nextAction[objname]=='startLoginBoxTimer')
  	{
		nextAction[objname]='';
		if(timeoutLoginBoxId != null)
	  {
	    clearTimeout(timeoutLoginBoxId);
	  }
	  timeoutLoginBoxId = setTimeout("slideup('memLoginBox');", 3000);
	}
  if(nextAction[objname]=='openNextTab')
  	{
		nextAction[currentTab]='';
		currentTab=nextTab;
		nextTab='';
		slidedown(currentTab);		
	}

}

function keepLoginOpen()
	{
		if(timeoutLoginBoxId != null)
	  {
	    clearTimeout(timeoutLoginBoxId);
	  }
	  timeoutLoginBoxId = setTimeout("slideup('memLoginBox');",15000);
	}

function swapLoginBox(box1,box2)
		{
		var boxA=document.getElementById(box1);
		if(boxA) boxA.style.display='none';
		var boxB=document.getElementById(box2);
		if(boxB) boxB.style.display='block';
		keepLoginOpen();
		}



