try
{
	if(window.top.document.getElementById("main").readyState == "complete")
	{
		setFocusTab();
	}
	else
	{
		window.top.document.getElementById("main").onreadystatechange = function()
		{
			if(window.top.document.getElementById("main").readyState == "complete")
			{
				setFocusTab();
				setFocusMenuItem();
			}
		}	
	}
}
catch(e)
{

}

var lastFocusTab	= null;
var lastFocusIndex	= 0;

var allTabArr		= ["spanDefault","spanUserConfig","spanMailUpgrade","spanMailAlias","spanMailNotify","spanAddr","spanMailAgent"];

var tabArr			= allTabArr;

function tabClick(src)
{
	try
	{
		setTabFocus(event.srcElement);
	}
	catch(e)
	{
		
	}
}



function setTabFocus(focusTab)
{
	if(!lastFocusTab)
	{	
		lastFocusTab = document.getElementById(tabArr[0]);
	}	
	lastFocusTab.className = "toptab";
	document.getElementById(lastFocusTab.id + "Line0").className = "lineseperate1";
	document.getElementById(lastFocusTab.id + "Line1").className = "lineseperate2";
	if(lastFocusIndex != 0)
	{
		document.getElementById(tabArr[lastFocusIndex-1] + "Line0").className = "lineseperate1";
		document.getElementById(tabArr[lastFocusIndex-1] + "Line1").className = "lineseperate2";
	}
	if(focusTab)
	{		
		var focusIndex = 0;
		for(var i=0;i<tabArr.length;i++)
		{
			if(focusTab.id == tabArr[i])
			{
				focusIndex = i;
				break;
			}
		}
		focusTab.className = "toptabfocus";
		if(focusIndex != 0)
		{
			document.getElementById(tabArr[focusIndex-1] + "Line0").className = "lineseperatefocus1";
			document.getElementById(tabArr[focusIndex-1] + "Line1").className = "lineseperatefocus2";
		}
		document.getElementById(focusTab.id + "Line0").className = "lineseperatefocus1";
		document.getElementById(focusTab.id + "Line1").className = "lineseperatefocus2";
		lastFocusTab	= focusTab;
		lastFocusIndex	= focusIndex;
	}
}

function setFocusMenuItem()
{
	try
	{
		var mainDoc		= window.top.frames["main"].document;
		var mainHref	= mainDoc.location.href;
		var folderWin	= window.top.frames["folder"];
		var folderDoc	= folderWin.document;
		var colA		= folderDoc.getElementsByTagName("a");
		var focusItem	= null;
		for(var i=0;i<colA.length;i++)
		{
			if(mainHref.toLowerCase() == colA[i].href.toLowerCase())
			{
				focusItem = colA[i].parentElement;
				break;
			}
		}
		if(!focusItem)
		{
			var fid		= getUrlParamValue(mainHref,"fid");
			focusItem	= folderDoc.getElementById("fdrItem" + fid);
		}
		folderWin.menuFolderFocus(focusItem);
	}
	catch(e)
	{
		
	}
}

function showLoadingPage()
{
	var loadingFrm	= window.top.document.getElementById("loading");
	var pageWidth	= 398;
	var pageHeight	= 188;
	var topPos		= (window.screen.availHeight - pageHeight)/2 - 100 + window.top.document.body.scrollTop;
	if(topPos <= 0)
		topPos +=	100;
	loadingFrm.style.left	= (window.screen.availWidth - pageWidth)/2 + window.top.document.body.scrollLeft;
	loadingFrm.style.top	= topPos;
	loadingFrm.style.width	= pageWidth;
	loadingFrm.style.height = pageHeight;
	loadingFrm.style.display = "";
}