	var firstSelectedCss = "firstTitle";
	var secondSelectedCss = "secondTitle";
	var thirdSelectedCss = "threeTitle";
        var menuSelectedCss = "menuSelectCss";
	var expandIDArray = [];
	var secondExpandForCustome = "secondExpandForCustome";
	var thirdExpandForCustome  = "thirdExpandForCustome";

		

	$(document).ready(function() {

		$("#sideBar>ul>li>ul").hide(); //隐藏一级频道
		$("#sideBar>ul>li>ul>li>ul").hide();//隐藏二级频道
                  $("#"+firstChannelID).addClass(menuSelectedCss);
		Select(currentID);
		RemoveUlWhenNotLi();
		NotExpand();
	});

	function Select(index)
	{
		Expand();
		var currentLi = $("#tab_"+index);
		
		if($("#tab_"+index).children(".subNav").html() != null)//表示选中一级频道
		{
			currentLi.addClass(firstSelectedCss);
		}
		
		if($("#tab_"+index).parent(".subNav").html() != null)//表示选中二级频道
		{
			currentLi.parents(".treeNavTitle").addClass(firstSelectedCss); //设置一级导航样式
			currentLi.removeClass(secondExpandForCustome); //设置二级导航样式
			currentLi.addClass(secondSelectedCss); //设置二级导航样式
		}
		
		if($("#tab_"+index).children("ul").html() == null)//表示选中三级频道
		{
			currentLi.parents(".treeNavTitle").addClass(firstSelectedCss); //设置一级导航样式
			currentLi.parent().parent("li").removeClass(secondExpandForCustome);
			currentLi.parent().parent("li").addClass(secondSelectedCss); //设置二级导航样式
			currentLi.addClass(thirdSelectedCss);  //设置三级导航样式
		}
		

		currentLi.children("ul").show();	//显示子频道
		currentLi.parents(".subNav").show();//显示父的顶级频道
		currentLi.parent("ul").show();//显示父二级频道
		
	}

	//当二级频道下不存在Li时，删除下面的UL
	function RemoveUlWhenNotLi()
	{
		var ul = $("#sideBar>ul>li>ul>li>ul");
		for( var i = 0;i<ul.length;i++)
		{
			if($(ul[i]).children("li").html() == null)
			{
				$(ul[i]).remove();
			}
		}
		
	}

	function NotExpand()
	{
		for(var i = 0;i<notExpandSecondChannelIDs.length;i++)
		{
			var crl = $("#tab_"+notExpandSecondChannelIDs[i]+">ul");
			if(crl.html())
			{
				$(crl).hide();
			}
			
			
		}
	}

	function Expand()
	{
		for(var i = 0;i<expandIDArray.length;i++)
		{
			var customExpand = $("#tab_"+expandIDArray[i]);
			$(customExpand).children("ul").show();
			$(customExpand).addClass(secondExpandForCustome);
			$(customExpand).children("ul").addClass(thirdExpandForCustome);
		}
	}