// 显示子标签页
// tabPreId: 子标签页控件ID前缀
// lnkPreId: 子标签链接控件ID前缀
// num:	子标签页序号		
function showSubTab(tabPreId,lnkPreId,num)
{	
	// 子标签页控件
	var tab;
	// 子标签链接控件
	var link;
	
	for(i = 1;; i++)
	{
		tab = document.getElementById(tabPreId + i);
		link = document.getElementById(lnkPreId + i);

		if (tab == null || link == null)
			break;

		if (i == num)
		{
			tab.style.display = "";
			link.className  = "button51";
		}
		else
		{
			tab.style.display = "none";	
			link.className = "button52";
		}									
	}				
}

// tabPreId:	标签ID前缀
// containerPreId: 容器ID前缀
// tabSelectedClassName: 标签选中时的样式
// tabUnselectedClassName: 标签未选中时的样式
function Tab(tabPreId,containerPreId,tabSelectedClassName,tabUnselectedClassName) {
	this.tabPreId = tabPreId;
	this.containerPreId = containerPreId;
	this.tabSelectedClassName = tabSelectedClassName;
	this.tabUnselectedClassName = tabUnselectedClassName;
}

// 显示标签和内容
// num:	子标签页序号	
Tab.prototype.show = function(num) {	
	// 容器
	var container;
	// 标签
	var tab;
	
	for(i = 0;; i++) {
		tab = document.getElementById(this.tabPreId + i);
		container = document.getElementById(this.containerPreId + i);

		if (tab == null || container == null)
			break;

		if (i == num) {
			container.style.display = "";
			tab.className  = this.tabSelectedClassName;
		}
		else {
			container.style.display = "none";	
			tab.className = this.tabUnselectedClassName;
		}									
	}				
}
