var tabBGImagePath = "" ;
var tabBGImageType = "_bg.gif" ;
var debug = false ;
function switchTab (tab)
{
	var tabName = getTabGroupName (tab.id) ;
	if (tabName == '')
	{
		alert ("No tabName for tab [" + tab.id + "]") ;
		return ;
	}
	var index = 1 ;
	while (true)
	{
		var tabTitle = document.getElementById (tabName + '_' + index) ;
		if (tabTitle == undefined)
			break ;
		deonTabTitle (tabTitle , tabName) ;
		var tabContent = document.getElementById (tabName + '_' + index + '_content') ;
		if (tabContent != undefined)
			tabContent.style.display = "NONE" ;
		index ++ ;
	}
	
	if (debug)
		alert ("Find " + (index - 1) + " tab title(s) for TabName [" + tabName + "]") ;
	onTabTitle (tab , tabName) ;
	var tabContent = document.getElementById (tab.id + '_content') ;
	if (tabContent != undefined)
		tabContent.style.display = "BLOCK" ;
	var tabHeader = document.getElementById (tabName + "_header") ;
	if (tabHeader != undefined)
	{
		tabHeader.className = "tabheader_" + tab.id ; 
	}
}
function getTabGroupName (tabId)
{
	if (tabId == '' || tabId == undefined)
	{
		alert ("tabId is NULL! [" + tabId + "]") ;
		return ;
	}
	var i = tabId.lastIndexOf ('_') ;
	if (i <= 1)
		return '' ;
	return tabId.substr (0 , i) ;
}
function deonTabTitle (tab , tabName)
{
	tab.className = tabName + "_off" ;
}
function onTabTitle (tab , tabName)
{
	tab.className = tabName + "_on" ;
}
//Í¼Æ¬ÂÖ²¥
function tabDivcnt(obj,num,len,cn)
{
	var cssname=cn;
	for(var id = 1;id<=len;id++)
	{
		var ss=obj+id;
		var snav =obj+"nav"+id;
		var scnt =obj+"cnt"+id;
		if(id==num)
		{
			try{document.getElementById(ss).style.display="block"}catch(e){};
			try{document.getElementById(snav).className=cssname}catch(e){};
			try{document.getElementById(scnt).style.display="block"}catch(e){};
		}
		else
		{
			try{document.getElementById(ss).style.display="none"}catch(e){};
			try{document.getElementById(snav).className=""}catch(e){};
			try{document.getElementById(scnt).style.display="none"}catch(e){};
		}
	}  
}
