
/**
 * Tab切换类库
 */
TabClass1 = function (config)
{
	this.tabName	= config.tabName;	//Tab的名称前缀
	this.cntName	= config.cntName;	//Tab的内容前缀
	this.number		= config.number;	//Tab的个?
	this.tabShowCls = config.tabShowCls;//活动的Tab的Class
	this.tabShowCls1 = config.tabShowCls1;
	if (config.tabHiddenCls)
		this.tabHiddenCls = config.tabHiddenCls;//非活动的Tab的Class    
	else
		this.tabHiddenCls = '';
	if (config.cntShowCss)
		this.cntShowCss	= config.cntShowCss;//活动的Tab的内容的样式
	else
		this.cntShowCss	= 'block';

	this.show = function(index){
		for (var i=0; i<this.number; i++) {
			if (i!=index) {
			    if(i==13)
			    {
			        $('#'+this.tabName+'_'+i).removeClass('Choose_NavOff');
                    $('#'+this.tabName+'_'+i).addClass('Choose_NavOffhidden');
                    $('#'+this.cntName+'_'+i).css('display', 'none');
			    }
			    else
			    {   
			        if(i!=4)
			        { 			        
					    $('#'+this.tabName+'_'+i).removeClass(this.tabShowCls);
                        if (this.tabHiddenCls)
						    $('#'+this.tabName+'_'+i).addClass(this.tabHiddenCls);
					    $('#'+this.cntName+'_'+i).css('display', 'none');
					}
					else
					{
					    $('#'+this.tabName+'_'+i).removeClass("Choose_cOn1");
					    $('#'+this.tabName+'_'+i).addClass("Choose_cOff1");
                        if (this.tabHiddenCls)
						    $('#'+this.tabName+'_'+i).addClass(this.tabHiddenCls);
					    $('#'+this.cntName+'_'+i).css('display', 'none');
					}
                }
			}
			else {
			        if(index==13)
			        {
                        $('#'+this.tabName+'_'+i).removeClass('Choose_NavOffhidden');
					    $('#'+this.tabName+'_'+i).addClass('Choose_NavOff');
					    $('#'+this.cntName+'_'+i).css('display', this.cntShowCss);
			        }
			        else
			        {
			            if(index!=4)
			            {
					        if (this.tabHiddenCls)
						        $('#'+this.tabName+'_'+i).removeClass(this.tabHiddenCls);
					        $('#'+this.tabName+'_'+i).addClass(this.tabShowCls);
					        $('#'+this.cntName+'_'+i).css('display', this.cntShowCss);
					    }
					    else//index==4 з
					    {
					        if (this.tabHiddenCls)
						        $('#'+this.tabName+'_'+i).removeClass(this.tabHiddenCls);
						    $('#'+this.tabName+'_'+i).removeClass("Choose_cOff1");
					        $('#'+this.tabName+'_'+i).addClass("Choose_cOn1");
					        $('#'+this.cntName+'_'+i).css('display','block');					        
					    }
                    }
			}
		}
	}
}

// Special ver for Index Map hot point switch
TabClassMap = function (config)
{
	this.tabName	= config.tabName;	//Tab的名称前缀
	this.cntName	= config.cntName;	//Tab的内容前缀
	this.number		= config.number;	//Tab的个?
	this.tabShowCls = config.tabShowCls.split("@");//活动的Tab的Class,多个用@分割
	if (config.tabHiddenCls)
		this.tabHiddenCls = config.tabHiddenCls
	else
		this.tabHiddenCls = '';
	if (config.cntShowCss)
		this.cntShowCss	= config.cntShowCss;//非活动的Tab的内容的样式
	else
		this.cntShowCss	= 'block';

	this.show = function(index){
		for (var i=0; i<this.number; i++) {
			if (i!=index) {
				$('#'+this.tabName+'_'+i).removeClass(this.tabShowCls[0]);
				$('#'+this.tabName+'_'+i).removeClass(this.tabShowCls[1]);
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).addClass(this.tabHiddenCls);
				$('#'+this.cntName+'_'+i).css('display', 'none');
			}
			else {
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).removeClass(this.tabHiddenCls);
				var tab_str = $('#'+this.tabName+'_'+i).text();
				var tab_str_len = tab_str.length;
				var templen = tab_str_len;
				for(var j=0;j<tab_str_len;j++)
				{
					var rstr=escape(tab_str.substring(j,j+1));
					if (rstr.substring(0,2)=="%u")
					{
						templen++;
					}
				}
				if(templen > 6)
					$('#'+this.tabName+'_'+i).addClass(this.tabShowCls[1]);
				else
					$('#'+this.tabName+'_'+i).addClass(this.tabShowCls[0]);
				$('#'+this.cntName+'_'+i).css('display', this.cntShowCss);
			}
		}
	}
}