function Zsk_InitSearchSelect(xmlDoc,objdpSelectParent,objdpSelectChild,intParentTypeID)
{
	objdpSelectParent = document.all('dpParentType');
	objdpSelectChild = document.all('dpChildType');
	//alert(objdpSelectParent.options.length)
	//清空
	objdpSelectParent.options.length = 0
	
	
	var root,ParentList,curParentNode;
	root = xmlDoc.documentElement;
	//alert(root.xml);

	ParentList = root.childNodes;
	var intId,strName,intSelectedIndex;
	for (var i=0; i<ParentList.length; i++) 
	{
		intId = parseInt(ParentList.item(i).getAttribute("id"));
		strName = "-----" + ParentList.item(i).getAttribute("name") + "-----";

		objdpSelectParent.options[i] = new Option(strName,intId);
		if (intId == intParentTypeID)
		{
			//alert(ParentList.item(i).getAttribute("name"))
			intSelectedIndex = i;
			curParentNode = ParentList.item(i);
			//alert(curParentNode.xml);
		}
	}
	objdpSelectParent.selectedIndex = intSelectedIndex;

	//填充子类
	Zsk_GerentChildSelect(intParentTypeID,objdpSelectChild,xmlDoc);
}
function Zsk_GetParentTypeNodeByID(parentTypeID,xmlDoc)
{
	var root,ParentList,curParentNode;
	root = xmlDoc.documentElement;
	//alert(root.xml);
	curParentNode = null;

	ParentList = root.childNodes;
	var intId,strName,intSelectedIndex;
	for (var i=0; i<ParentList.length; i++) 
	{
		intId = parseInt(ParentList.item(i).getAttribute("id"));
		if (intId == parentTypeID)
		{
			curParentNode = ParentList.item(i);
		}
	}
	return curParentNode;
}
function Zsk_GerentChildSelect(parentTypeID,objdpSelectChild,xmlDoc)
{
	objdpSelectChild = document.all('dpChildType');
	objdpSelectChild.options.length = 0;
	
	parentTypeID = parseInt(parentTypeID);

	var parentTypeNode,childList;
	parentTypeNode = Zsk_GetParentTypeNodeByID(parentTypeID,xmlDoc);
	if (parentTypeNode == null)
	{
		return;
	}
	childList = parentTypeNode.childNodes;

	var intId,strName;
	objdpSelectChild.options[0] = new Option("-----选择分类-----","")
	for (var i=1; i<childList.length+1; i++) 
	{
		intId = parseInt(childList.item(i-1).getAttribute("id"));
		strName = childList.item(i-1).getAttribute("name");

		objdpSelectChild.options[i] = new Option(strName,intId);
	}
}

function Zsk_GenerateTypeList(xmlDoc,parentTypeID)
{
	var strHtml;
	var parentTypeNode,childList;
	root = xmlDoc.documentElement;
	//alert(root.xml);

	parentTypeNode = Zsk_GetParentTypeNodeByID(parentTypeID,xmlDoc);
	childList = parentTypeNode.childNodes;
	var intId,strName,intSelectedIndex;
	strHtml = '<table width="85%" border="0" align="center" cellspacing="0" cellpadding="1"><tr>';
	for (var i=0; i<childList.length; i++) 
	{
		intId = parseInt(childList.item(i).getAttribute("id"));
		strName = childList.item(i).getAttribute("name");
		strHtml += '<td width="50%" class="h12160"><span class="h12160">'
		strHtml +='<a href="lb.asp?typeid='+intId+'" >' 
		strHtml +='<font color="#000066" onMouseOver="this.color=\'#FF0000\'" onMouseOut="this.color=\'#000066\'">'+strName+'</font>' 
		strHtml +='</a></span></td>';
		if ((i+1)%2 == 0 && i != childList.length-1 )
		{
			strHtml +='</tr><tr>';
		}
	}
	if ((i)%2 == 1)
	{
		strHtml +='<td width="50%" class="h12160">&nbsp;</td>';
	}
	strHtml +='</tr></table>';

	//tdTypesList.innerHTML = xmlTypes.XMLDocument.transformNode(xslTypes.XMLDocument);
	tdTypesList.innerHTML = strHtml;
	//alert(tdTypesList.innerHTML);
}

function Zsk_GenerateTypeList2(xmlDoc,parentTypeID)
{
	var strHtml;
	var parentTypeNode,childList;
	root = xmlDoc.documentElement;
	//alert(root.xml);

	parentTypeNode = Zsk_GetParentTypeNodeByID(parentTypeID,xmlDoc);
	childList = parentTypeNode.childNodes;
	var intId,strName,intSelectedIndex;
	strHtml = '<table width="90%" border="0" align="center" cellpadding="3" cellspacing="3" style="margin-top:10px"><tr>';
	for (var i=0; i<childList.length; i++) 
	{
		intId = parseInt(childList.item(i).getAttribute("id"));
		strName = childList.item(i).getAttribute("name");
		strHtml += '<td width="50%">'
		strHtml +='<a href="lb.asp?typeid='+intId+'" class="A01">'+strName 
		strHtml +='</a></td>';
		if ((i+1)%2 == 0 && i != childList.length-1 )
		{
			strHtml +='</tr><tr>';
		}
	}
	if ((i)%2 == 1)
	{
		strHtml +='<td width="50%" class="h12160">&nbsp;</td>';
	}
	strHtml +='</tr></table>';

	//tdTypesList.innerHTML = xmlTypes.XMLDocument.transformNode(xslTypes.XMLDocument);
	tdTypesList.innerHTML = strHtml;
	//alert(tdTypesList.innerHTML);
}

function Init_Page(parentTypeID)
{
	Zsk_InitSearchSelect(xmlTypes.XMLDocument,'dpParentType','dpChildType',parentTypeID);
	Zsk_GenerateTypeList(xmlTypes.XMLDocument,parentTypeID);

}			

function Init_Page2(parentTypeID)
{
	Zsk_InitSearchSelect(xmlTypes.XMLDocument,'dpParentType','dpChildType',parentTypeID);
	Zsk_GenerateTypeList2(xmlTypes.XMLDocument,parentTypeID);

}			


function Article_Wldf(MsgID,MsgTitle,AuthorID,AuthorName,ChannelCode)
{
	var strUrl
	strUrl = "/bbs/wldf.asp?MsgID=" + MsgID + "&MsgTitle=" +	MsgTitle + "&AuthorID=" + AuthorID + "&AuthorName=" + AuthorName + "&ChannelCode=" + ChannelCode;
	OpenWindow(strUrl);
}

function popwin(strUrl)	
{
	var popwindow;
	popwindow = window.open(strUrl,null,"height=600,width=800,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");	
	popwindow.focus();	
}
function popwin(strUrl,winname)	
{
	var popwindow;
	popwindow = window.open(strUrl,winname,"height=600,width=800,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");	
	popwindow.focus();	
}
function OpenWindow(strUrl){
		var newWin
	newWin = window.open(strUrl,null,"height=400,width=450,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");		
	newWin.moveTo(window.screen .availWidth/2 - 225,window.screen .availHeight/2 - 225)
	newWin.focus();	
	}
function Article_RecommendTopic(MsgID,ForumCode,strFromUrl)
{
	var strUrl;
	if (ForumCode=="")
	{
		ForumCode = "bbs";
	}
	strUrl = "/hyjlb/alltj.asp?id=" + MsgID + "&target=" + ForumCode + "&strUrl=" + strFromUrl;
	OpenWindow(strUrl);
}
function Article_Wgxq(MsgID,MsgName,ForumCode)
{
	var strUrl;
	if (ForumCode=="")
	{
		ForumCode = "bbs";
	}
	strUrl = "/bbs/wgxq1.asp?id=" + MsgID + "&title=" + MsgName + "&target=" + ForumCode;
	OpenWindow(strUrl);
}

function getStrLength(str)
{
	var Len1,Len2;
	Len1 = str.length;
	Len2 = 0
	for (var i=0;i<Len1 ;i++ )
	{
		if (str.charCodeAt(i)>255)
		{
			Len2 += 2;
		}
		else
		{
			Len2 += 1;
		}
	}
	return Len2;
}