	/*
	彭启利 2005-9-21 17:00 随时修改
	QQ 8520518 
	Email newpeng@163.com
	*/
	function CMenuData(pid,id,level,txt,title,link,target,mfunc,mvar)
	{
		if(typeof(title)=="undefined" || title==null) title = "";
		if(typeof(link)=="undefined") link = "";
		if(typeof(target)=="undefined") target = "_self";
		this.pid = pid;
		this.id = id;
		this.txt = txt;
		this.title = title;
		this.link = link;
		this.target = target;
		this.mfunc = mfunc;
		this.level = level;
		this.mvar = mvar;
		this.son = 0;
	}
	var ArrayAllMenu = new Array();
	function CMenu(pic_path,mc1,mc2)
	{
		this.menu_number = ArrayAllMenu.length;
		this.data_array = new Array();//记录所有的数据
		this.html_array = new Array();//记录菜单html
		this.ms = "abx";
		if(typeof(pic_path) == "undefined") pic_path = "";
		if(typeof(mc1) == "undefined") mc1 = "#0087CC";
		if(typeof(mc2) == "undefined") mc2 = "#FFFFCC";
		this.pic_path = pic_path;
		this.mc1 = mc1;
		this.mc2 = mc2;
		ArrayAllMenu[this.menu_number] = this;
		return true;
	}
	CMenu.prototype.AddMenuItem=function(pid,id,txt,title,link,target,mfunc,mvar)
	{
		var level = 0;
		if(typeof(this.data_array[pid])=="undefined")
		{
			pid = 0;
			level = 1;
		}
		else
		{
			level = this.data_array[pid].level+1;
		}
		if(typeof(this.data_array[id])!="undefined") return false;
		if(pid != 0) this.data_array[pid].son++;
		this.data_array[id] = new CMenuData(pid,id,level,txt,title,link,target,mfunc,mvar);
		if(!document.all("id_div_menu_"+level))
		{
			var ms_menu = "";
			ms_menu += "<iframe  style=\"position:absolute;z-index:"+this.menu_number+";width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight);top:expression(this.nextSibling.offsetTop);left:expression(this.nextSibling.offsetLeft);\" frameborder=\"0\" ></iframe>";
			ms_menu += "<div oncontextmenu='return false;' onselectstart='return false;' id='id_div_menu_"+level+"' style='position:absolute;display:none; border-width:1; border-style:outset; padding:1; width:70; height:10; z-index:1; left: 20; top: 100;background-color:"+this.mc1+"'></div>";
			//document.body.insertAdjacentHTML("beforeEnd",ms_menu);
			document.write(ms_menu);
		}
		return id;
	}
	CMenu.prototype.SetupMenu=function(pid)
	{
		var tArray = this.data_array;
		
		this.html_array[0] = "";
		for(var p in tArray)
		{
			if(typeof(this.html_array[tArray[p].pid]) == "undefined") this.html_array[tArray[p].pid] = "<tr height=1><td width=99%></td><td></td></tr>";
			var ms_next = "";
			var ms_submenu = "show_next_menu(this,'"+this.menu_number+"','"+tArray[p].id+"')";
			if(tArray[p].son > 0) ms_next = "<img src='"+this.pic_path+"arrow.gif'>";
			var ms_link1 = "";
			var ms_link2 = "";
			if(tArray[p].link != "")
			{
				ms_link1 = "<a href='"+tArray[p].link+"' target='"+tArray[p].target+"'>";
				ms_link2 = "</a>";
			}
			this.html_array[tArray[p].pid] += "<tr id='i_tr_"+p+"' style='cursor:hand' height=17 onclick=menu_onclick('"+this.menu_number+"','"+tArray[p].id+"') ";
			this.html_array[tArray[p].pid] += "onmouseover=restore_tr_bgcolor("+this.menu_number+",this);"+ms_submenu+" onmouseout=\"this.style.backgroundColor='"+this.mc1+"'\"><td title='"+tArray[p].title+"' nowrap>"+ms_link1+tArray[p].txt+ms_link2+"&nbsp;</td><td>"+ms_next+"</td></tr>";
		}
		var ms_menu = "";
		for(var p in this.html_array)
		{
			ms_menu = "";
			ms_menu += "<table cellspacing=0 cellpadding=0 width='100%' border=0 style='font-size:10pt'>";
			ms_menu += this.html_array[p];
			ms_menu += "</table>";
			this.html_array[p] = ms_menu;
		}
	}
	function restore_tr_bgcolor(menu_number,mobj)
	{
		var mm = ArrayAllMenu[menu_number];
		var t = mobj.offsetParent;
		for(var i=0;i<t.rows.length;i++)
		{
			t.rows[i].style.backgroundColor = mm.mc1;
		}
		mobj.style.backgroundColor = mm.mc2;
	}
	function menu_onclick(menu_number,id)
	{
		var mdata = ArrayAllMenu[menu_number].data_array[id];
		if(typeof(mdata.mfunc) == "function")
		{
			show_menu_to_leve();
			mdata.mfunc(mdata.mvar);
		}
		else
		{
			var mm = ArrayAllMenu[menu_number];
			if(typeof(mm.data_array[id].link) != "undefined" && mm.data_array[id].link != "") show_menu_to_leve();
		}
	}
	function show_next_menu(mmobj,menu_number,pid,x,y)
	{
		if(typeof(pid)=="undefined") pid = 0;
		if(typeof(x)=="undefined") x = 0;
		if(typeof(y)=="undefined")
		{
			var mm = ArrayAllMenu[menu_number];
			if(mm.data_array[pid].pid != 0)
			{
				var mobj = eval("i_tr_"+mm.data_array[pid].pid);
				mobj.style.backgroundColor = mm.mc2;
				//alert(mm.data_array[pid].pid)
			}
			//mmobj.style.backgroundColor="red";
			//alert(mmobj.offsetParent.offsetParent.id);
			//alert(pid);
			y = 0;
		}
		var level = 0;
		try
		{
			var mobj = mmobj;
			var ttop  = mobj.offsetTop;
			var thei  = mobj.clientHeight;
			var tw  = mobj.clientWidth;
			var tleft = mobj.offsetLeft;
			while (mobj = mobj.offsetParent)
			{
				ttop+=mobj.offsetTop; 
				tleft+=mobj.offsetLeft;
			}
			var mdata = ArrayAllMenu[menu_number];
			
			for(var p in mdata.data_array)
			{
				if(mdata.data_array[p].pid == pid)
				{
					level = mdata.data_array[p].level;break;
				}
			}
			if(pid == 0)
			{
				document.all('id_div_menu_'+level).style.top = ttop+thei+25+y;
				document.all('id_div_menu_'+level).style.left = tleft+25+x;
			}
			else
			{
				document.all('id_div_menu_'+level).style.top = ttop-2+y;
				document.all('id_div_menu_'+level).style.left = tleft+tw+x;
			}
			
			document.all('id_div_menu_'+level).innerHTML = mdata.html_array[pid];
			
		}catch(e)
		{
			level = ArrayAllMenu[menu_number].data_array[pid].level;
		}
		show_menu_to_leve(level);
	}
	function show_menu_to_leve(level)
	{
		if(typeof(level)=="undefined") level = -1;
		var mlevel = parseInt(level,10);
		if(isNaN(mlevel)) mlevel = 0;
		var mi = 1;
		while(document.all("id_div_menu_"+mi))
		{
			if(mi<=mlevel && mlevel>=0) document.all("id_div_menu_"+mi).style.display = "";
			else
			{
				if(document.all("id_div_menu_"+mi).style.display == "none") return;
				document.all("id_div_menu_"+mi).style.display = "none";
				document.all("id_div_menu_"+mi).innerHTML = "";
			}
			mi++;
		}
		
	}
	CMenu.prototype.ShowMenu=function(mcontrol,x,y)
	{
		if(typeof(x)=="undefined") x = 0;
		if(typeof(y)=="undefined") y = 0;
		var ab;
		show_next_menu(mcontrol,this.menu_number,ab,x,y)
	}
	function hidden_all_menu()//不能隐藏当前点击的div
	{
		var mobj = event.srcElement;
		var tArray = new Array();
		while (mobj)
		{
			try
			{
				if(mobj.id.indexOf("id_div_menu_")>=0) tArray[tArray.length] = mobj;
			}catch(e){}
			mobj = mobj.offsetParent;
		}
		if(tArray.length == 0) show_menu_to_leve();
		
	}
	try{AddDocumentFuncMouseDown("hidden_all_menu","hidden_all_menu()");}catch(e){}
	