//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function DoAction(message,value)
{
	switch(message)
	{
		case "selectTab":
			selectTab(value, true);
			break;
	}
}


//-----------------------------------------------------------------------------
function blinkSelected()
{
	var currentTab = getObject(currentSelectedTab);
	currentTab.className = "tabHighlighted";	
	setTimeout("resetBlink()", 200);
}


//-----------------------------------------------------------------------------
function resetBlink()
{
	var currentTab = getObject(currentSelectedTab);
	currentTab.className = "tabSelected";
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function selectTab(tabId, doBlink)
{
  try
  {
    var currentTab = getObject(currentSelectedTab);
    var newTab     = getObject(tabId);
    
    if (currentTab != null && newTab != null)
    {
      currentTab.className = "tabNormal";
      newTab.className = "tabSelected";
      currentSelectedTab = tabId;
      
			SendMessage(_NAVIGATION_FRAMENAME, "tabSelected", tabId);								

      var infoText = getObject("infoText");
      var tabImg = getObject(currentSelectedTab + "Img");
      if (tabImg && infoText)
      {
				var title = tabImg.getAttribute("title");
				if (title)
				{
					infoText.innerHTML = title;
				}
      }
      
      if( doBlink && doBlink == true )
      {
				setTimeout("blinkSelected()", 400);
				setTimeout("blinkSelected()", 800);
				setTimeout("blinkSelected()", 1200);
      }
    } 
  }
  catch (e)
  {
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function onMouseOver(tabId)
{
  try
  {
    if (currentSelectedTab != tabId)
    {
      var currentTab = getObject(currentSelectedTab);
      var hoverTab   = getObject(tabId);
      if (currentTab != null && hoverTab != null)
      {
        hoverTab.className = "tabHover";
        
        var infoText = getObject("infoText");
        var tabImg = getObject(tabId + "Img");
        if (tabImg && infoText)
        {
					var title = tabImg.getAttribute("title");
					if (title)
					{
						infoText.innerHTML = title;
					}
        }
      }
    } 
  }
  catch (e)
  {
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function onMouseOut(tabId)
{
  try
  {
		if (currentSelectedTab != tabId)
		{
			var currentTab = getObject(currentSelectedTab);
			var hoverTab    = getObject(tabId);
			if (currentTab != null && hoverTab != null)
			{
				hoverTab.className = "tabNormal";
	      
				var infoText = getObject("infoText");
				var tabImg = getObject(currentSelectedTab + "Img");
				if (tabImg && infoText)
				{
					var title = tabImg.getAttribute("title");
					if (title)
					{
						infoText.innerHTML = title;
					}
				}
			} 
		}
  }
  catch (e)
  {
  }
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function onLoad()
{
  var infoText = getObject("infoText");
  var tabImg = getObject(currentSelectedTab + "Img");
  if (tabImg && infoText)
  {
		var title = tabImg.getAttribute("title");
		if (title)
		{
			infoText.innerHTML = title;
		}
  }
}


