/*
NAME:20csh  QQ:47210879(UFO)    2003-8-29
*/
var MENU_WIDTH = 80
var MENU_BORDER_COLOR		= '#999999'
var MENU_BACKGROUND_COLOR	= '#f1f1f1'
var MENU_CURRENTPAGE_COLOR	= '#ffffff'
var MENU_MOUSEOVER_COLOR	= '#cccccc'
var MENU_MOUSEDOWN_COLOR	= '#999999'
var MENU_SHADOW_COLOR		= '#666666'
//下拉菜单相关代码     DVBBS
 var p_id="";
 var h;
 var w;
 var l;
 var t;
 var topMar = 1;
 var leftMar = -2;
 var space = 1;
 var isvisible;
 var MENU_SHADOW_COLOR='#DEE3E7';//定义下拉菜单阴影色
 var global = window.document
 global.fo_currentMenu = null
 global.fo_shadows = new Array

  function selcom(longid,classidname)
{
window.location="todefault.asp?id="+longid+"";
}
function ck(obj,obj1){
if(obj.lowsrc=="") return true;
obj.imgRolln=obj.src;
obj.src=obj.lowsrc;
obj.lowsrc=obj.imgRolln;
if(obj1.style.display=='none')
   obj1.style.display='';
else
   obj1.style.display='none';
}
//显示菜单

function show_menu(){
var i;
for(i=0;i<trees.length;i++){
  if(trees[i].child!="0")
       document.write("<div id='D" + trees[i].longid + "' style='Z-INDEX: 2; VISIBILITY: hidden; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px'></div>");
  if(trees[i].parentclassid=="0") 
  {
	  document.write ("<img  hspace='4' align='absmiddle' src='image/titlbg.gif'><a class='wh' href='JavaScript:selcom("+ trees[i].longid +",\""+ trees[i].classidname +"\");' onMouseOver='whichone(" + trees[i].longid + ");");
	  if(trees[i].child!="0")
	  document.write ("ShowMenu(\"" + trees[i].longid + "\",0,D" +  trees[i].longid + ");");
	  document.write ("'>" + trees[i].classidname + "</a>");
  }
 }
}

//显示树型

function ShowMenu(id,tWidth,obj) {
	vSrc = window.event.srcElement;
	if(vSrc.tagName=="A" && tWidth!=0) return false;
	var i,vMnuCode="",len=0,c_id=0;
    for(i=0;i<trees.length;i++){
	  if (trees[i].longid==id) c_id=i
	   if(trees[i].parentclassid==id) {
	      if(trees[i].classidname.length>len)  len=trees[i].classidname.length;	
		  if(trees[i].classidname=="-")
		     vMnuCode = vMnuCode + "<tr><td colspan=2 height=1 style='font-size: 1px;background-color: #999999;'></td></tr>";
		  else{
	          vMnuCode = vMnuCode + "<tr><td onmouseover=\"over();";
		  if(trees[i].child!="0") vMnuCode = vMnuCode + "whichone(" + trees[i].longid + ");ShowMenu(\'" + trees[i].longid + "\',100,D" +  trees[i].longid + ");";
		  else  vMnuCode = vMnuCode + "whichone_child(" + i + ");";
			  vMnuCode = vMnuCode + "\" onmouseout='out();' class=flyoutLink handle='support'><a class='ListLink' href='JavaScript:selcom("+ trees[i].longid +",\""+ trees[i].classidname +"\");' >" + trees[i].classidname + "</a></td><TD width=5>" ;
		  if(trees[i].child!="0")
		     vMnuCode = vMnuCode + "<img src=flyout_arrow.gif>";
	      vMnuCode = vMnuCode+ "</td></tr>";
		   }
		  }}
		  len*=16;
		  len+=40;
	      
	vMnuCode = "<table id='submenu" + id + "' width='" + len + "'bgcolor='#F6F6F6' class=flyoutMenu style='BORDER-TOP-WIDTH: 1px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px;BORDER-LEFT-WIDTH: 1px;' cellSpacing=0 cellPadding=2 width=180 border=0 menudata='#hpflyout'><TBODY><tr><td align=center>" + vMnuCode + "</td></tr></TBODY></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	l = vSrc.offsetLeft + leftMar + 4;
	t = vSrc.offsetTop + topMar + h + space-2;
	   vParent = vSrc.offsetParent;
	   while (vParent.tagName.toUpperCase() != "BODY")
	   {
		   l += vParent.offsetLeft;
		   t += vParent.offsetTop;
		   vParent = vParent.offsetParent;
	   }
    if(trees[c_id].parentclassid!="0"){
		l = l + vSrc.offsetWidth + 5;
		t = t - vSrc.offsetHeight - topMar - 1;
		if((l+len)>document.body.offsetWidth) 
		   {
		     l=l - vSrc.offsetWidth - len + 1 - 5;
			 if(l<0) l=0;
			 }
	  }
	obj.innerHTML = vMnuCode
	obj.style.top = t;	
	obj.style.left = l;

	obj.style.visibility = "visible";
}
//下拉菜单相关代码结束

function whichItem()
{
	var e = event.srcElement
	while (e.tagName != "TD")
		e = e.parentElement
	return e
}

function over()
{
	var e = whichItem();
	if (e.style.backgroundColor != MENU_CURRENTPAGE_COLOR)
	{
		e.style.borderColor = MENU_BORDER_COLOR
		e.style.backgroundColor = MENU_MOUSEOVER_COLOR
	}
}
function out()
{
	var e = whichItem();
		e.style.borderColor = MENU_BACKGROUND_COLOR
		e.style.backgroundColor = MENU_BACKGROUND_COLOR
}

function whichone(temp_id)
{    for(var i=trees.length-1;i>=0;i--)
      if(trees[i].child!="0")
        if(trees[i].longid==temp_id){
		   temp_id=trees[i].parentclassid;
		   eval("D" + trees[i].longid).style.visibility ="visible";
		 }
		 else
		 eval("D" + trees[i].longid).style.visibility ="hidden";
}

function whichone_child(temp_id)
{  for(var i=trees.length-1;i>=0;i--)
      if(trees[i].child!="0" && trees[i].parentclassid==trees[temp_id].parentclassid)
		 eval("D" + trees[i].longid).style.visibility ="hidden";
}


