//下面是解析自定义分类xml输出一个菜单
try
{
	var error = "";
	if(typeof(classfield) == "undefined")error += "资源文件\"classfield\"没有定义\r\n";
	XMLcolumn.load(classfield);
	var user_nodes = XMLcolumn.documentElement.childNodes;
}
catch(e)
{
}

/*
横向菜单
hWidth显示的字符个数
hbg头底色
hbgon头鼠标移上的颜色
hf头字体颜色
hfon头字体鼠标移上颜色
*/

function across_menu(hwidth,hbg,hbgon,hf,hfon)
{
	try{
if(user_nodes.length > 0)
{
writestyle(hf,hbg,hbgon);
document.write('<div  style="position:absolute;z-index:1;width:100%;height:1;"  ID=plane>') 
document.write('<table  id="td123"  cellspacing=2 width=100%  border=0  style="BORDER:#999999  1px  solid;cursor:hand"  cellpadding="0"  bgcolor='+hfon+'>')
document.write('<tr>')
for(var i=0;i<user_nodes.length;i++)
			{
				child=user_nodes.item(i);
				var tmpns = child.attributes.item(0).nodeValue;
				var tmpvs = child.attributes.item(1).nodeValue;
				var p = "pi"+i;

document.write('<td width="80" class=normal  onMouseDown="this.className=\'down\'" onMouseOver="this.className=\'up\',high(this),'+p+'.style.visibility=\'visible\'"  onMouseOut="this.className=\'normal\',low(this),'+p+'.style.visibility=\'hidden\'"  style="filter:alpha(opacity=50)"onMouseUp="this.className=\'up\'"  > ')
document.write("<span><a href=\"javascript:check1('"+tmpns+"','"+tmpvs+"');changepos('"+tmpvs+"','"+tmpns+"','','')\">"+tmpvs+"</a></span>")
document.write('</td> ')
			}
document.write('</tr></table>')

			for(var i=0;i<user_nodes.length;i++)
			{
				child=user_nodes.item(i);
				var tmpns = child.attributes.item(0).nodeValue;
				var tmpvs = child.attributes.item(1).nodeValue;
				
				var p = "pi"+i;
				var top = i*70;
				var childlength = child.childNodes.length;
document.write('<div  id="'+p+'"  style="position:absolute;left:'+top+'px;top:20;  z-index:1;  visibility:  hidden;  width:  140" onMouseOver=this.style.visibility=\'visible\' onMouseOut=this.style.visibility=\'hidden\'>') 
document.write('<table  cellspacing=2  width=136  border=0  style="BORDER:#999999  1px  solid;cursor:hand"  cellpadding="0"  bgcolor='+hfon+'  align="right">')      
				for(var j = 0;j<childlength;j++)
				{
					child1 = child.childNodes.item(j);
					var tmpn = child1.attributes.item(0).nodeValue;
					var tmpv = child1.attributes.item(1).nodeValue;
					document.write('<tr>') 
					document.write(' <td  class=normal  onMouseDown="this.className=\'down\'" onMouseOver="this.className=\'up\',high(this)"  onMouseOut="this.className=\'normal\',low(this)"  style="filter:alpha(opacity=50)"onMouseUp="this.className=\'up\'">')
					document.write("<span  align='center'><a href=\"javascript:check1('"+tmpn+"','"+tmpv+"');check2('"+tmpns+"','"+tmpvs+"');changepos('"+tmpv+"','"+tmpn+"','"+tmpvs+"','"+tmpns+"')\">"+tmpv+"</a></span>")
					document.write('</td>')
					document.write('</tr>')
				}
					document.write('</table>');
					document.write('</div>');
			}
					document.write('</div>');
}
	}
	catch(e)
	{
	}
}

/*
纵向菜单
hbg头底色
hbgon头鼠标移上的颜色
hf头字体颜色
hfon头字体鼠标移上颜色
hWidth显示的字符个数
*/
function erect_menu(hWidth, hbg,hbgon,hf,hfon)
{
	try{
if(user_nodes.length > 0)
{
writestyle(hf,hbg,hbgon);

document.write('<div  style="position:absolute;z-index:1;width:1;height:1;"  ID=plane>') 
document.write('<table  id="td123"  cellspacing=2  width=100  border=0  style="BORDER:#999999  1px  solid;cursor:hand"  cellpadding="0"  bgcolor='+hfon+'>')
			for(var i=0;i<user_nodes.length;i++)
			{
				child=user_nodes.item(i);
				var tmpns = child.attributes.item(0).nodeValue;
				var tmpvs = child.attributes.item(1).nodeValue;
				var p = "pi"+i;

document.write('<tr>')
document.write('<td  class=normal  onMouseDown="this.className=\'down\'" onMouseOver="this.className=\'up\',high(this),'+p+'.style.visibility=\'visible\'"  onMouseOut="this.className=\'normal\',low(this),'+p+'.style.visibility=\'hidden\'"  style="filter:alpha(opacity=50)"onMouseUp="this.className=\'up\'"  > ')
document.write("<span><a href=\"javascript:check1('"+tmpns+"','"+tmpvs+"');changepos('"+tmpvs+"','"+tmpns+"','','')\">"+tmpvs+"</a></span>")
document.write('</td> </tr>')
			}
document.write('</table>')

			for(var i=0;i<user_nodes.length;i++)
			{
				child=user_nodes.item(i);
				var tmpns = child.attributes.item(0).nodeValue;
				var tmpvs = child.attributes.item(1).nodeValue;
				var p = "pi"+i;
				var top = i*18+3;
				var childlength = child.childNodes.length;
document.write('<div  id="'+p+'"  style="position:absolute;top:'+top+'px;left:96;  z-index:1;  visibility:  hidden;  width:  140" onMouseOver=this.style.visibility=\'visible\' onMouseOut=this.style.visibility=\'hidden\'>') 
document.write('<table  cellspacing=2  width=136  border=0  style="BORDER:#999999  1px  solid;cursor:hand"  cellpadding="0"  bgcolor='+hfon+'  align="right">')      
				for(var j = 0;j<childlength;j++)
				{
					child1 = child.childNodes.item(j);
					var tmpn = child1.attributes.item(0).nodeValue;
					var tmpv = child1.attributes.item(1).nodeValue;
					document.write('<tr>') 
					document.write(' <td  class=normal  onMouseDown="this.className=\'down\'" onMouseOver="this.className=\'up\',high(this)"  onMouseOut="this.className=\'normal\',low(this)"  style="filter:alpha(opacity=50)"onMouseUp="this.className=\'up\'">')
					document.write("<span  align='center'><a href=\"javascript:check1('"+tmpn+"','"+tmpv+"');check2('"+tmpns+"','"+tmpvs+"');changepos('"+tmpv+"','"+tmpn+"','"+tmpvs+"','"+tmpns+"')\">"+tmpv+"</a></span>")
					document.write('</td>')
					document.write('</tr>')
				}
					document.write('</table>');
					document.write('</div>');
			}
					document.write('</div>');
}
	}
	catch(e)
	{
	}
}

/*
全部显示的分类

*/

function normal_menu()
{

	try
	{
        theDoc.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
		if(user_nodes.length >0)
		{
		for(var i=0;i<user_nodes.length;i++)
		{
			child=user_nodes.item(i);
			var tmpns = child.attributes.item(0).nodeValue;
			var tmpvs = child.attributes.item(1).nodeValue;
			var childlength = child.childNodes.length;
             theDoc.write("   <tr>")
             theDoc.write('     <td width="2%"><font face="Webdings">4</font></td>')
             theDoc.write("  <td width=\"98%\"><a href=\"javascript:check1('"+tmpns+"','"+tmpvs+"');changepos('"+tmpvs+"','"+tmpns+"','','')\" ><b>"+tmpvs+"</b></a></td>")
             theDoc.write('       </tr>')
             theDoc.write('     <tr>')
             theDoc.write('         <td width="2%">&nbsp;</td>')
             theDoc.write('       <td width="98%">')
			for(var j = 0;j<childlength;j++)
			{
				child1 = child.childNodes.item(j);
				var tmpn = child1.attributes.item(0).nodeValue;
				var tmpv = child1.attributes.item(1).nodeValue;
				theDoc.write("<a href=\"javascript:check1('"+tmpn+"','"+tmpv+"');check2('"+tmpns+"','"+tmpvs+"');changepos('"+tmpv+"','"+tmpn+"','"+tmpvs+"','"+tmpns+"')\">"+tmpv+"</a>　")
			}
			theDoc.write("</td></tr>");
		}
		}
		else
		{
			theDoc.write("<tr><td>&nbsp;</td></tr>");
		}
		theDoc.write("</table>");
	}
	catch(e)
	{
	}

}

/*
下拉菜单

*/
function pull_menu()
{
	try
	{
		//document.write("<table border=0 width=120 style=\"word-break:break-all\">");

		for(var i=0;i<user_nodes.length;i++)
		{
			child=user_nodes.item(i);
			var tmpns = child.attributes.item(0).nodeValue;
			var tmpvs = child.attributes.item(1).nodeValue;
			var childlength = child.childNodes.length;
			var p = "Parent"+i;
			var c = "Child"+i;
			//document("<tr><td>");
			theDoc.write("<div id="+p+" onmouseover=\"showhide('"+i+"')\"><a href=\"javascript:check1('"+tmpns+"','"+tmpvs+"');changepos('"+tmpvs+"','"+tmpns+"','','')\" >"+tmpvs+"</a></div><div id="+c+" style=\"display:none\">")
			for(var j = 0;j<childlength;j++)
			{
				child1 = child.childNodes.item(j);
				var tmpn = child1.attributes.item(0).nodeValue;
				var tmpv = child1.attributes.item(1).nodeValue;
				theDoc.write("　<a href=\"javascript:check1('"+tmpn+"','"+tmpv+"');check2('"+tmpns+"','"+tmpvs+"');changepos('"+tmpv+"','"+tmpn+"','"+tmpvs+"','"+tmpns+"')\">"+tmpv+"</a><br>")
			}
			theDoc.write("</div>");
			//document.wirte("</td></tr>");
		}
		//document.wirte("</table>");
	}
	catch(e)
	{
	}
}


function shows(nums)
{
	try
	{
		var i=nums;
		var s=user_nodes.length;
		var ids;
		for(ids=0;ids<s;ids++)
		{
			if(ids!=i)
			{
			theDoc.all.item("Child"+ids).style.display="none";
			}
		}
	}
	catch(e)
	{
	}
}
function hide(nums)
{
	try
	{
		var s=user_nodes.length;
		theDoc.all.item("Child"+nums).style.display = "none";
	}
	catch(e)
	{
	}

}
function showhide(nums)
{
	try
	{
		var s=user_nodes.length;
		theDoc.all.item("Child"+nums).style.display=(theDoc.all.item("Child"+nums).style.display=='none'?'':'none');
		shows(nums);	
	}
	catch(e)
	{
	}
}

try
{
	var max_tag=true;
	if(user_nodes.length < 1)
	{
		Layer1.style.display = "none";
	}
}
catch(e)
{
}

function max_min()
{
	if(max_tag)
	{
		drift_frame_body.style.display="none";
		Layer1.style.height=22;
		change_size.src="images/max_over.gif";
		max_tag=false;
	}
	else
	{
		drift_frame_body.style.display="block";
		Layer1.style.height=250;
		Layer1.style.zIndex = 1;
		change_size.src="images/min_over.gif";
		max_tag=true;
	}
}
function change_img(get_tag)
{
	if(max_tag)
		if(get_tag)
			change_size.src="images/min_over.gif";
		else
			change_size.src="images/min_none.gif";
	else
		if(get_tag)
			change_size.src="images/max_over.gif";
		else
			change_size.src="images/max_none.gif";
}

//-->
function  flashit()
{
try
{
if  (!document.all) return
if(td123.style.borderColor=="#666666")td123.style.borderColor="#999999" 
else td123.style.borderColor="#666666" 
}
catch(e)
	{
	}
} 
setInterval("flashit()",  500)
function  high(image)
{
	theobject=image
	highlighting=setInterval("highlightit(theobject)",100)
}
function  low(image)
{ 
	clearInterval(highlighting)
	image.filters.alpha.opacity=50 
}
function  highlightit(cur2)
{
	if  (cur2.filters.alpha.opacity<100)cur2.filters.alpha.opacity+=20
	else if(window.highlighting)
	clearInterval(highlighting)
} 
function writestyle(fcolor,bgup,bgdown)
{
	document.write("<style>")
	document.write("a  {font-size:9pt;color:"+fcolor+";text-decoration:none}")
	document.write(".normal  {padding:1px;font-size:9pt;}")
	document.write(".up  {padding:1px;border:#999999  1px  solid;background:"+bgup+";font-size:9pt;}")
	document.write(".down  {padding:1px;border:#dbdbdb  1px  solid;background:"+bgdown+";font-size:9pt;}")
	document.write("</style>")
}

