var targetURL;
var indexCNURL;
var divs_tree = ["chanelTree_21","chanelTree_34","chanelTree_115","chanelTree_224","chanelTree_272"];

function showChanelTree(str)
{
	for(var i = 0 ; i < divs_tree.length;i++)
	{
		if(str == divs_tree[i])
			document.getElementById(divs_tree[i]).style.display = "";
		else
			document.getElementById(divs_tree[i]).style.display = "none";
	}
	
}
function getURLByChanelID(chanelid){
	var chanels_cn = CC_sitemap[0].leaf;
	var curChanelUrl;
	for(var i = 0 ; i < chanels_cn.length;i++)
	{
		if(chanels_cn[i].id == chanelid){
			curChanelUrl = chanels_cn[i].url;
			
			break;
			
		}
		if(chanels_cn[i].leaf){
		for(var j = 0 ; j <chanels_cn[i].leaf.length;j++)
		{
			if(chanels_cn[i].leaf[j].id == chanelid){
				curChanelUrl = chanels_cn[i].leaf[j].url;				
				break;
				
			}
			if(chanels_cn[i].leaf[j].leaf){
				for(var p = 0 ; p<chanels_cn[i].leaf[j].leaf.length;p++)
				{
					if(chanels_cn[i].leaf[j].leaf[p].id == chanelid){	
						curChanelUrl = chanels_cn[i].leaf[j].leaf[p].url;						
						break;
						
					}
				}
			}
		}
		}
	}
	return curChanelUrl;
}
function getAllURLs(chanelid){
var chanels_cn =  CC_sitemap[0].leaf;
var fid,fn,fu,sn,su,tn,tu;
	for(var i = 0 ; i < chanels_cn.length;i++)
	{
		//alert(chanels_cn[i].id+"kkk:"+chanelid)
		if(chanels_cn[i].id == chanelid){
			url = chanels_cn[i].url;
			
			fid = chanels_cn[i].id;
			chanelname = chanels_cn[i].name;
			fn = chanelname;
			fu = url;
			break;
			
		}
		if(chanels_cn[i].leaf)
		for(var j = 0 ; j <chanels_cn[i].leaf.length;j++)
		{
			if(chanels_cn[i].leaf[j].id == chanelid){
				url = chanels_cn[i].leaf[j].url;
				fid = chanels_cn[i].id;
				chanelname = chanels_cn[i].leaf[j].name;
				fn = chanels_cn[i].name;
				fu = chanels_cn[i].url;
				sn = chanelname;
				su = url;
				break;
				
			}
			if(chanels_cn[i].leaf[j].leaf)
				for(var p = 0 ; p<chanels_cn[i].leaf[j].leaf.length;p++)
				{
					if(chanels_cn[i].leaf[j].leaf[p].id == chanelid){
						url = chanels_cn[i].leaf[j].leaf[p].url;
						chanelname = chanels_cn[i].leaf[j].leaf[p].name;
						fid = chanels_cn[i].id;
						fn = chanels_cn[i].name;
						fu = chanels_cn[i].url;
						sn = chanels_cn[i].leaf[j].name;
						su = chanels_cn[i].leaf[j].url;
						tn = chanelname;
						tu = url;
						break;
						
					}
				}
		}
	}
	if(tn)
		return [fid,fn,fu,sn,su,tn,tu];
	else if(sn)
		return [fid,fn,fu,sn,su];
	else
		return [fid,fn,fu];
}
function coverLoadOK(){
	document.getElementById("tc").style.display="";	
	
	if(typeof onContentOK == "function"){
		onContentOK();
		onContentOK = null;
	}
	  //将频道树的高度置为与加载页面高度一致
	//document.getElementById("table_left").style.height = document.getElementById("contentTable").scrollHeight -50;
	//document.getElementById("table_left").style.height = document.body.scrollTop+document.body.clientHeight-eltUtil.getY(pdiv);
	//锚点，加载完后跳回顶部
	var pdiv = document.getElementById("navigate");		
	window.scrollTo(0, eltUtil.getY(pdiv)-document.scrollHeight);
	var whs = window.location.hash;
	var  titleFilled = document.getElementById("titleFilled");
	var  contentFilled = document.getElementById("contentFilled");
	var  xiufuTitle = document.getElementById("xiufuTitle");
	var  xiufuContent = document.getElementById("xiufuContent");
	var  keyanTitle = document.getElementById("keyanTitle");
	var  keyanContent = document.getElementById("keyanContent");
	var  chuantongTitle = document.getElementById("chuantongTitle");
	var  chuantongContent = document.getElementById("chuantongContent");
	if(whs=="#211")
		titleFilled.style.display="none";
	
	if(whs=="#212"){
		titleFilled.innerHTML = xiufuTitle.innerHTML;
		contentFilled.innerHTML =  xiufuContent.innerHTML;
		xiufuTitle.style.display="none";
		xiufuContent.style.display="none";
		keyanTitle.style.display="";
		keyanContent.style.display="";
		chuantongTitle.style.display="";
		chuantongContent.style.display="";
		titleFilled.style.display="";
	}
	
	if(whs=="#213"){
		titleFilled.innerHTML = keyanTitle.innerHTML;
		contentFilled.innerHTML =  keyanContent.innerHTML;
		
		xiufuTitle.style.display="";
		xiufuContent.style.display="";
		keyanTitle.style.display="none";
		keyanContent.style.display="none";
		chuantongTitle.style.display="";
		chuantongContent.style.display="";
		titleFilled.style.display="";
	}
	if(whs=="#214"){
		titleFilled.innerHTML = chuantongTitle.innerHTML;
		contentFilled.innerHTML = chuantongContent.innerHTML;
		xiufuTitle.style.display="";
		xiufuContent.style.display="";
		keyanTitle.style.display="";
		keyanContent.style.display="";
		chuantongTitle.style.display="none";
		chuantongContent.style.display="none";
		titleFilled.style.display="";
	}
	
	/*
	if(Browser["isIE"]){
		switch(whs){
		case "#212":
			document.getElementById("xiufu_wb").click();
			break;
		case "#213":
			document.getElementById("keyan_wb").click();
			break
		case "#214":
			document.getElementById("chuantong_wb").click();
			break;
		case "#21":case "#34":case "#115":case "#224":case "#272":case "#480":			
			document.getElementById("shouye_top").click();
			break;
		}
		
		if(whs!="#212"&&whs!="#213"&&whs!="#214"&&whs!="#21"&&whs!="#34"&&whs!="#115"&&whs!="#224"&&whs!="#272"&&whs!="#480")
			document.getElementById("fromhere").click();
	}
	*/
	//else
		//document.getElementById("fromhere").onclick();
	
}
function siteMapcallBack(){

}
var chanelname;
var url;
function showChanels(chanelid,flag,isFromNavigator)
{
	//陶瓷论坛点击后显示：http://localhost/shtml/115/@/9036.html#220?陶瓷
	if(chanelid.toString().indexOf("?")!=-1)
		chanelid = chanelid.split("?")[0];
	var fid,fn,fu,sn,su,tn,tu;
	var urls = getAllURLs(chanelid);
	fid = urls[0];
	fn = urls[1];
	fu = urls[2];
	sn = urls[3];
	su = urls[4];
	tn = urls[5];
	tu = urls[6];
	showChanelTree("chanelTree_"+fid);
	
	
	var navigationtype=navigationType();
	var chanelName = document.getElementById("chanelName");
	//if (navigationtype == "firefox")
		chanelName.innerHTML = "<span style=\"cursor:pointer;\" onclick=\"showFirstCover('"+fu+"','"+fn+"','1')\">"+fn+"</span>";
	//else
		//chanelName.innerText = "<span style=\"cursor:pointer;\" onclick=\"showFirstCover('"+fu+"','"+fn+"','1')\">"+fn+"</span>";
	

		if(window.location.hash==""||isFromNavigator){		
			window.location.hash = mapCopy[url]; //for cpw
		}else{
			siteMapcallBack();
		}
		var tree = document.getElementById("chanelTree");
		document.getElementById("tc").style.display="none";
		if(chanelid=="34"||chanelid=="480"){
			tree.style.display="none"
		}
		else{
			tree.style.display="";				
			tree.style.paddingLeft="8px";
		}
		AjaxUtil.loadHTML(url,document.getElementById("tc"),coverLoadOK);		
		//AjaxUtil.loadHTML("http://localhost/shtml/59/@/4039.html",document.getElementById("dl_content"));

		
		
	
	expectedHash = window.location.hash;
	//AjaxUtil.loadHTML(url,document.getElementById("tc"));	
	var navigate = document.getElementById("navigate");
	
	
	
	if(!flag)
		navigate.innerHTML = "<a href='#' class=\"otherNavigator\"  onclick=\"showindex('"+indexCNURL+"');return false;\">首页&nbsp;>&nbsp;</a><a>"+chanelname+"</a>";
	else
		if(typeof tn != "undefined")
			navigate.innerHTML = "<a href='#' class=\"otherNavigator\"  onclick=\"showindex('"+indexCNURL+"');return false;\">首页&nbsp;>&nbsp;</a><a class=\"otherNavigator\"  href='#' onclick=\"showFirstCover('"+fu+"','"+fn+"','1');return false;\">"
									+fn+"&nbsp;>&nbsp;</a><a class=\"otherNavigator\"  onclick=\"showFirstCover('"+su+"','"+sn+"','2','"+fn+"','"+fu+"')\";return false;\">"
									+sn+"&nbsp;>&nbsp;</a><span class=\"curNavigator\">"+chanelname+"</span>";
		else if(typeof sn != "undefined")
			navigate.innerHTML = "<a href='#' class=\"otherNavigator\" onclick=\"showindex('"+indexCNURL+"');return false;\">首页&nbsp;>&nbsp;</a><a href='#'class=\"otherNavigator\" onclick=\"showFirstCover('"+fu+"','"+fn+"','1');return false;\">"
									+fn+"&nbsp;>&nbsp;</a><span class=\"curNavigator\">"
									+sn+"</span>";
		else
			navigate.innerHTML = "<a href='#' class=\"otherNavigator\"  onclick=\"showindex('"+indexCNURL+"');return false;\">首页&nbsp;>&nbsp;</a><span class=\"curNavigator\">"
			+fn+"</span>";

	return false;

	//if(Browser.isIE)			
		//checkSave();	
	
}
function showindex(indexurl)
{
	window.open(indexurl,"_self");
	//href='#' onclick=\"showindex('"+indexCNURL+"');return false;\"
}



function pollHash() {
  handleHistory();
  //alert("window.location.hash "+window.location.hash+"expectedHash "+expectedHash)
  window.setInterval("handleHistory()", 1000);
  return true;
}
function handleHistory()
{
	//alert("window.location.hash "+window.location.hash+"expectedHash "+expectedHash)
  if ( window.location.hash != expectedHash )
  {
	  expectedHash = window.location.hash; 
	  if(window.location.hash!="") {  
		  var u;
		  for(var k in mapCopy){
			  if (mapCopy[k]==expectedHash.split("#")[1]){
				  u = k;
				  break;
			  }
			                                             
		  }
		  
		  AjaxUtil.loadHTML(u,document.getElementById("tc"),coverLoadOK);
	  }
	  
		  
  }
  return true;
}
var expectedHash = "";

var curChanelID;
var lastChanelID;
var chanelname_;
var chanels_cn;
var chanels_uk
 var chanelUrl;
 var isSimple;
 
 var mapCopy = {};
 
 //var historyFrame  = document.getElementsByTagName("iframe");
// historyFrame.history.go(-999)
 //var t = document.getElementById("t");
 var expectURL="";
 var maxHistory=100;
 var historyList=[];
 var historyOffset=0;
 var timer;
 
 function checkSave(){
 	if(timer)clearTimeout(timer);
 	timer=setTimeout(saveHistory,500);
 }
 function saveHistory(){	 
 	
 	historyList[historyOffset]=window.location.hash;
 	historyOffset++;
 	historyList.length=historyOffset
 	
 	
 	//var url = historyFrame.location.protocol+"//"+historyFrame.location.pathname+"?";
 	var url="hiddenpage.html?";
 	
 	historyFrame.location=url+historyOffset+"#"+historyOffset;
 	//alert(historyFrame.location)
 	
 	
 }
 function gotoHistory(n){
	 
	
	
 	if(n<historyOffset){
 		//historyList[historyOffset]=window.location.hash;
 	}else if(n>historyOffset){
 		
 	}else return;
 	
 		historyOffset = n;
 	
 	var url ;
 	
 	
 	for(var k in mapCopy){ 		
 		if(mapCopy[k]==historyList[historyOffset-1].substr(1)){
 			url = k;
 			break;
 		}
 	}
 	
 	AjaxUtil.loadHTML(url,document.getElementById("tc"),coverLoadOK);
 	//t.focus();
 }

 
 
window.onload = function(){	
	LOGIN.func.onLoad();
	//检查是否已经在首页登陆
	//alert('load');
	//LOGIN.func().onload();
/*	var username = getCookie("userName");
	if(username){
		
		var userarea = document.getElementById("loginTip");
		if(username.length<=6)
			userarea.innerHTML = username+"&nbsp;你好！";
		else
			userarea.innerHTML = username;
		document.getElementById("userName").disabled = "false";
		document.getElementById("pwd").disabled = "false";
	}else{
		
		document.getElementById("userName").removeAttribute('disabled');
		document.getElementById("pwd").removeAttribute('disabled');
	}*/
	historyList[historyOffset]=window.location.hash;
	historyOffset++;
	
	
	//checkSave();
	var firstURL;	
	var secondURL;
	var thirdURL;
	var firstNAME;
	var secondNAME;
	var thirdNAME;
	var firstID;
	var secondID;
	var thirdID;
	
	chanels_cn = CC_sitemap[0].leaf;
	chanels_uk = CC_sitemap[1].leaf;
	chanelUrl = dpmLg.getUrlOfCache();
	isSimple = dpmLg.isSimple();
	
	var chanelID;
	var isShowAllNavigator;
	/*if (chanelUrl.indexOf("?") == -1 ){
		if(!isSimple){
			chanelID = chanelUrl.split("/")[2];
		}
		else{			
			chanelID = chanelUrl.split("/")[4];
		}
		isShowAllNavigator = false;
	}
	else{
		chanelID = chanelUrl.split('?')[1];		
		isShowAllNavigator = true;
	}*/
	if(chanelUrl.indexOf("#") == -1){
		if(!isSimple){
			chanelID = chanelUrl.split("/")[2];
		}
		else{			
			chanelID = chanelUrl.split("/")[4];
		}
		isShowAllNavigator = false;		
	}
	else{
		var hs = chanelUrl.split('#')[1];
		if(hs==""||hs=="AAAAA_Main"||hs=="AAAAA_top")
			chanelID = "115";
		else
			chanelID = hs;	
		
		isShowAllNavigator = true;
	}
	
	var navigationtype=navigationType();
	var menu_left = document.getElementById("menu_left");
	for(var i = 0 ; i < chanels_cn.length;i++){
		if(chanels_cn[i].id ==chanelID ){
			chanelname_ = chanels_cn[i].name;
			break;
		}
	}
	//取首页的url；
	indexCNURL = "http://"+window.location.host+CC_sitemap[0].url;
	//indexCNURL = "http://"+chanelUrl.split("/")[2]+CC_sitemap[1].leaf[1].url;
	
	for(var i = 0 ; i < chanels_cn.length;i++)
	{
		if(chanels_cn[i].leaf&&chanels_cn[i].name.indexOf("CC")==-1){
			//chanelname_ = chanels_cn[i].name;
			
			firstNAME = chanels_cn[i].name;
			firstURL = chanels_cn[i].url;
			firstID = chanels_cn[i].id;
			mapCopy[firstURL] = firstID;
			var div_ = document.createElement("div");
			div_.id="chanelTree_"+chanels_cn[i].id;
			div_.style.display="none";
			//div_.style.width='145px';
			div_.className="sdmenu";
			div_.align="center";
			var firstLeaf = chanels_cn[i].leaf;
			if(typeof(firstLeaf) != "undefined"){
			for(var j = 0 ; j <firstLeaf.length;j++)
			{
				
				var div2_ = document.createElement("div");
				div2_.className = "collapsed";
				var span_ = document.createElement("span");
				secondNAME = firstLeaf[j].name;
				secondURL = firstLeaf[j].url;
				secondID = firstLeaf[j].id;
				mapCopy[secondURL] = secondID;
				/*if(navigationtype == "firefox")
					span_.innerHTML = secondNAME; //2级
				else
					span_.innerText = secondNAME;
				*/
				
				var hr_ = document.createElement("hr");
				hr_.style.height="2px";
				hr_.style.width="94%";
				hr_.style.noshade = true;
				if(!chanels_cn[i].leaf[j].leaf)
					span_.className="nosub";
				else
					span_.className="hassub";
				//span_.onclick = Function("return showSecondChanelCover('"+firstURL+"','"+firstNAME+"','"+secondURL+"','"+secondNAME+"');return false;");
				
				
				div2_.appendChild(span_);
				span_.innerHTML = "<span onclick=\"showSecondChanelCover('"+firstURL+"','"+firstNAME+"','"+secondURL+"','"+secondNAME+"');return false;\">"+secondNAME+"</span>";
				//span_.onclick  =  Function("return test()");

				div2_.appendChild(hr_);
				if(chanels_cn[i].leaf[j].leaf){
				for(var p = 0 ; p<firstLeaf[j].leaf.length;p++)
				{
					var a_ = document.createElement("a");
					a_.className = "last";
					thirdURL = firstLeaf[j].leaf[p].url;
					var id =  firstLeaf[j].leaf[p].id;	
					thirdID = id;
					thirdNAME = firstLeaf[j].leaf[p].name;
					var curchanelurl;
					//a_.onclick  =  Function("return  showThirdChanelCover('"+id+"','"+firstNAME+"','"+firstURL+"','"+secondNAME+"','"+secondURL+"','"+thirdNAME+"','"+thirdURL+"');return false;");  
					var hname = "CC_BK_"+id;					
					//a_.href="#"+thirdID;
					//a_.href="#AAAAA_MAIN";
					//a_.target="_top";
					mapCopy[thirdURL] = thirdID;
					
					div2_.appendChild(a_);
					
					
					a_.innerHTML = "<span onclick=\"showThirdChanelCover('"+id+"','"+firstNAME+"','"+firstURL+"','"+secondNAME+"','"+secondURL+"','"+thirdNAME+"','"+thirdURL+"');return false;\">"+thirdNAME+"</span>";
				}
				}
				div_.appendChild(div2_);
			}
			}
			menu_left.appendChild(div_);
			myMenu = new SDMenu("chanelTree_"+chanels_cn[i].id);
			myMenu.init();
		}

	}
	
	//pollHash();
	var isFromNavigator = true;
	var urlFromaddress = window.location.toString();
	//#408#63 for caopw
	var hashs=[];
	if(urlFromaddress.indexOf("#")!=-1)
		hashs = urlFromaddress.split("#");
	if(hashs.length>2)
		isFromNavigator = false;
	//从资源搜索进入到学术沙龙　/shtml/115/@/9036.html#227?100283?《清明上河图》及宋代风俗画国际学术研讨会（论文摘要）
	var searchs=[];
	if(urlFromaddress.indexOf("?")!=-1)
		searchs = urlFromaddress.split("?");
	if(searchs.length>2)
		isFromNavigator = false;

	showChanels(chanelID,isShowAllNavigator,isFromNavigator);
	
	//showChanels(chanelID,chanelUrl,firstID,firstNAME,firstURL,secondID,secondNAME,secondURL,thirdID,thirdNAME,thirdURL,isShowAllNavigator);
}

function showSecondChanelCover(firUrl,firName,secUrl,secName)
{

	//if(Browser.isIE)			
		//checkSave();
	var navigate = document.getElementById("navigate");
	navigate.innerHTML="<a href='#' class=\"otherNavigator\"  onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<a href='#' class=\"otherNavigator\" onclick=\"showFirstCover('"+firUrl
							+"','"+firName+"','1');return false;\">"+firName+"</a>&nbsp;>&nbsp;<span class=\"curNavigator\">"+secName+"</span>";
	
	//window.location.hash = secUrl;
	window.location.hash = mapCopy[secUrl];
	expectedHash = window.location.hash;

	AjaxUtil.loadHTML(secUrl,document.getElementById("tc"),coverLoadOK);
	
	//解决从资料搜索进来后带一搜索条件，当点击了其他的频道后再回去想看该频道的所有记录时，结果又查的是带有搜索条件的
	if(window.location.search!="")
		window.location.search="";
}
function showThirdChanelCover(curchanelID,name1,url1,name2,url2,name3,url3,lunTan,docTitle_xstd)
{
	
	
	//if(Browser.isIE)			
		//checkSave();
	//区分从论谈连接还是从更多连接
	var searchStr="";
	var searchValue="";
	if( typeof lunTan!="undefined"){
		if(lunTan.indexOf("ysbnsub=")!=-1){
		searchStr = "ysbnsub";
		searchValue = lunTan.split("ysbnsub=")[1];
		}
		else{
			searchStr = "luntan";
			searchValue = lunTan;
		}
	}
	else
		searchStr="luntan";
	var testURL = window.location.host+url2;
	var navigate = document.getElementById("navigate");
	thirdID = curchanelID;
	
	if(name3==undefined){
		
		if(typeof lunTan !="undefined")
			
			window.location.hash = encodeURI(mapCopy[url2]+"?"+lunTan+"?"+docTitle_xstd);
		else
			window.location.hash = mapCopy[url2];
	
		expectedHash = window.location.hash;
		AjaxUtil.loadHTML(url2,document.getElementById("tc"),coverLoadOK);
		navigate.innerHTML = "<a href='#' class=\"otherNavigator\"  onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<a href='#' class=\"otherNavigator\"  onclick=\"showFirstCover('"+url1
		+"','"+name1+"','1');return false;\">"+name1+"</a>&nbsp;>&nbsp;<span class=\"curNavigator\" >"+name2+"</span>";

	}
	else{
		
		
		if(typeof lunTan !="undefined"){
			window.location.hash = mapCopy[url3];
			window.location.search = "?"+searchStr+"="+searchValue;
		}
		else{
			window.location.hash = mapCopy[url3];
			
		}
		expectedHash = window.location.hash;
		
		document.getElementById("tc").href=url3;
		AjaxUtil.loadHTML(url3,document.getElementById("tc"),coverLoadOK);		
		navigate.innerHTML = "<a href='#' class=\"otherNavigator\" onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<a href='#' class=\"otherNavigator\" onclick=\"showFirstCover('"+url1
		+"','"+name1+"','1');return false;\">"+name1+"</a>&nbsp;>&nbsp;<a href='#'class=\"otherNavigator\"  onclick=\"showFirstCover('"+url2+"','"+name2+"','2','"+name1+"','"+url1+"');return false;\">"
		+name2+"</a>&nbsp;>&nbsp;<span class=\"curNavigator\">"+name3+"</span>";
	}
	

	//解决从资料搜索进来后带一搜索条件，当点击了其他的频道后再回去想看该频道的所有记录时，结果又查的是带有搜索条件的
	if(window.location.search!="")
		window.location.search="";		
	
}

function showFirstCover(curURL,curName,grade,parentName,parentUrl)
{

	
	window.location.hash = mapCopy[curURL];
	expectedHash = window.location.hash;

	AjaxUtil.loadHTML(curURL,document.getElementById("tc"),coverLoadOK);	
	var navigate = document.getElementById("navigate");
	if(grade == 1)
		navigate.innerHTML = "<a href='#' class=\"otherNavigator\" onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<span class=\"curNavigator\">"+curName+"</span>"
	else
		navigate.innerHTML = "<a href='#' class=\"otherNavigator\" onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<a  class=\"otherNavigator\" onclick=\"showFirstCover('"+parentUrl+"','"+parentName+"','1');return false;\">"+parentName+"</a>"
							+"&nbsp;>&nbsp;<span class=\"curNavigator\">"+curName+"</span>"
//解决从资料搜索进来后带一搜索条件，当点击了其他的频道后再回去想看该频道的所有记录时，结果又查的是带有搜索条件的
	if(window.location.search!="")
		window.location.search="";
	
}

function digitalType(chanelid)
{
	var parentUrl;
	var curChanelUrl;
	thirdID = chanelid;
	var chanelName;
	var chanels_cn = CC_sitemap[0].leaf;
	for(var i = 0 ; i < chanels_cn.length;i++)
	{
		if(chanels_cn[i].id == chanelid){
			curChanelUrl = chanels_cn[i].url;
			chanelName = chanels_cn[i].name;
			break;
			return ;
		}
		if(chanels_cn[i].leaf)
		for(var j = 0 ; j <chanels_cn[i].leaf.length;j++)
		{
			if(chanels_cn[i].leaf[j].id == chanelid){
				curChanelUrl = chanels_cn[i].leaf[j].url;
				parentUrl = chanels_cn[i].url;
				chanelName = chanels_cn[i].leaf[j].name;
				break;
				return;
			}
			if(chanels_cn[i].leaf[j].leaf)
				for(var p = 0 ; p<chanels_cn[i].leaf[j].leaf.length;p++)
				{
					if(chanels_cn[i].leaf[j].leaf[p].id == chanelid){	
						curChanelUrl = chanels_cn[i].leaf[j].leaf[p].url;
						parentUrl = chanels_cn[i].leaf[j].url;
						chanelName = chanels_cn[i].leaf[j].leaf[p].name;
						break;
						return;
					}
				}
		}
	}
	targetURL = curChanelUrl;
	var navigate = document.getElementById("navigate");
	//window.location=curChanelUrl;
	if (navigate)
	{
			navigate.innerHTML = "<a class=\"otherNavigator\" href='#' onclick=\"showindex('"+indexCNURL+"');return false;\">首页</a>&nbsp;>&nbsp;<a class=\"otherNavigator\" href='#' onclick=\"showFirstCover('"+parentUrl+"','"+chanelname+"','1');return false;\">"
						+chanelname+"&nbsp;>&nbsp;</a><span class=\"curNavigator\">"
						+chanelName+"</span>";
			window.location.hash = mapCopy[curChanelUrl];
			expectedHash = window.location.hash;

			AjaxUtil.loadHTML(curChanelUrl,document.getElementById("tc"),coverLoadOK);	
	}
	else
	{
		window.open(curChanelUrl);
	}
	
	

	
}



function showSubChanel(subChanelID,lunTan)
{
	var fid,fn,fu,sn,su,tn,tu;
	var urls = getAllURLs(subChanelID);
	fid = urls[0];
	fn = urls[1];
	fu = urls[2];
	sn = urls[3];
	su = urls[4];
	tn = urls[5];
	tu = urls[6];
	
	
	if(typeof lunTan !="undefined")
		showThirdChanelCover(fid,fn,fu,sn,su,tn,tu,lunTan);//文物频道ID为220
	
	else
		showThirdChanelCover(fid,fn,fu,sn,su,tn,tu);

}

//收藏与打印函数，在藏品页中用
var thirdID;
/*function favoritPage()
{
	//http://localhost/shtml/118/@/3786.html

	//var curUrl = window.location+"?"+thirdID;	
	var curUrl = chanelUrl;
	favoritname = document.title;//标题 
	if(favoritname == null){ 
		var t_titles = document.getElementByTagName("title") 
		if(t_titles && t_titles.length >0) 
		{ 
		   favoritname = t_titles[0]; 
		}else{ 
		   favoritname = ""; 
		} 
	} 	
	var favoritname = document.getElementByTagName
	if (window.sidebar) {
		window.sidebar.addPanel(favoritname, curUrl,"");
	} else if( document.all ) {
		window.external.AddFavorite( curUrl, favoritname);
	} else if( window.opera && window.print ) {
	return true;
	}
}*/


function getDocDetail(docUrl)
{
	var location = chanelUrl;
	var cururl = "http://"+chanelUrl.split("/")[2]+docUrl;
	
	window.open(cururl,"_blank");
}


