// This javascript module requires the dab_common.js module

var calendarsTabList = new Array();
calendarsTabList[calendarsTabList.length] = "calendarsTab::WallCalendars";
calendarsTabList[calendarsTabList.length] = "calendarsTab::YearAtAGlance";
calendarsTabList[calendarsTabList.length] = "calendarsTab::MousePad";
calendarsTabList[calendarsTabList.length] = "calendarsTab::Magnet";
calendarsTabList[calendarsTabList.length] = "calendarsTab::Examples";

function enableCalendarsTab (tabId, resetHash)
{
  for ( var i=0; i < calendarsTabList.length; i++ )
  {
	switchTabs( tabId, calendarsTabList[i] );
  }
  if (resetHash)
  {
  	setHash( tabId );
  }
}


function setHash (tabId)
{
	var hash = tabId.substr(tabId.lastIndexOf(":")+1);
	if (typeof hash != "undefined" && hash != "")
	{
		if (hash == "WallCalendars")
		{
			location.hash = "";
		}
		else
		{
			location.hash = hash;
		}
	}
}


function selectInitialTab()
{
	var hash = location.hash;
	if (typeof hash != "undefined" && hash != "")
	{
		if (hash == "#YearAtAGlance")
		{
			enableCalendarsTab( "calendarsTab::YearAtAGlance", false );
		}
		else if (hash == "#MousePad")
		{
			enableCalendarsTab( "calendarsTab::MousePad", false );
		}
		else if (hash == "#Magnet")
		{
			enableCalendarsTab( "calendarsTab::Magnet", false );
		}
		else if (hash == "#Examples")
		{
			enableCalendarsTab( "calendarsTab::Examples", false );
		}
	}
}
