	var haveOverId	=null;
	var idName			=new Array("menubgImg","menubg");
	var imagePath		="../";
	var defBG			="default_bg.gif";
	var fun					=null;
	var stop=false;
	
	function menuElement(titlePic,width,overBG,overColor,location,xpos)
	{
		this.titlePic=titlePic;
		this.width=width;
		this.overBG=overBG;
		this.overColor=overColor;
		this.location=location;
		this.xpos=xpos;
	}
	
	function Menu_ShowLayer(menu,id)
	{
		
		var vSrc;
		if (!event)
		{
			vSrc=eval("pic"+haveOverId);
		}
		else
		{
			vSrc    = window.event.srcElement;
		}
	  var vParent = vSrc.offsetParent;
	  var T       = 0;
	  var L       = 0;
	  h = vSrc.offsetHeight;
	  w = vSrc.offsetWidth;
	  l = vSrc.offsetLeft;
	  t = vSrc.offsetTop;
	  while(vParent.tagName.toUpperCase()!="BODY")
	  {
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	  }
	  secbox.style.top        = t + h + 10;
	  if (menuArray[id].xpos!=0)
	  {
	  	secbox.style.left       = l-menuArray[id].xpos;
	  }
	  else
	  {
	  	secbox.style.left       = l;
	  }
	  var iHTML="";
	  for (i=0;i<menu.length/2;i++)
	  {
	  	iHTML+="| <a href=\""+menu[2*i+1]+"\" class=\"white\">"+menu[2*i]+"</a> "
	  	if (i==menu.length/2-1)
			iHTML+="|";
	  }
	  secmenu.innerHTML=iHTML;
	  secbox.filters.alpha.opacity=0;
	  turnMenu();
	}
	function turnMenu(status)  //改变菜单状态
	{
		
		if (arguments.length==0)
		{
			status=1;
			stop=false;
		}
		if (status==0)
			stop=true;
		if (status)//if (!stop)
		{	
		  secbox.filters.alpha.opacity=100;
			/*if (secbox.filters.alpha.opacity<100) //showLayer
			{
				secbox.filters.alpha.opacity+=10;
				fun=setTimeout("turnMenu("+status+")",30);
				
			}	
			else
			{
				clearTimeout(fun);
				fun=null;
			}*/
		}
		else
		{
		  secbox.filters.alpha.opacity=0;
			/*if (secbox.filters.alpha.opacity>0)  //hide layer
			{
				secbox.filters.alpha.opacity-=10;
				fun=setTimeout("turnMenu("+status+")",30);
				
			}
			else
			{
				clearTimeout(fun);
				fun=null;
				stop=false;
			}	*/	
		}
	}
	
	function swapEle(id)  // 显示菜单
	{		
				if (arguments.length>0)
				{
					eval(idName[0]+id+".style.backgroundImage=\"url("+imagePath+menuArray[id].overBG+")\"");
					eval(idName[1]+id+".style.background=\""+menuArray[id].overColor+"\"");
					haveOverId=id;
					if (id!=0)
						Menu_ShowLayer(secMenuArray[id-1],id);
				}
				else
				{
					
					var s=event.srcElement;
					var eId=parseInt(s.id.replace(/(.*)([0-9])/g,"$2"));
					eval(idName[0]+eId+".style.backgroundImage=\"url("+imagePath+menuArray[eId].overBG+")\"");
					eval(idName[1]+eId+".style.background=\""+menuArray[eId].overColor+"\"");
					if (eId!=haveOverId && haveOverId!=null)
					{
						eval(idName[0]+haveOverId+".style.backgroundImage=\"url("+imagePath+defBG+")\"");
						eval(idName[1]+haveOverId+".style.background=\'none\'");
					}
					haveOverId=eId;
					if (eId!=0)
						Menu_ShowLayer(secMenuArray[eId-1],eId);
					else
						turnMenu(0);
				}
				
	}
	function createMenu()
	{
		
		var headStr			="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" id=\"topmenu\">\n";
		headStr     			+="<tr valign=\"top\" align=\"left\">\n";
		var trailStr			="</tr>\n";
		trailStr			  		+="</table>\n";
		var tempStr="";
		tempStr+=headStr;
		for (i in menuArray)
		{
			tempStr+="<td  id=\"menu"+i+"\" >\n" +
			"<table width=\""+menuArray[i].width+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" +
			"	<tr>\n" +
			"    <td align=\"left\" valign=\"top\">\n" +
			"			<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" +
			"  			<tr>\n" +
			"	        <td width=\"2\" align=\"left\" valign=\"top\"><img src=\"midea2004_16.gif\" width=\"2\" height=\"24\"></td>\n" +
			"        	<td align=\"center\" valign=\"middle\" id=\"menubgImg"+i+"\" style=\"background-image:url("+imagePath+defBG+")\"><a href=\""+menuArray[i].location+"\"><img src=\""+imagePath+menuArray[i].titlePic+"\"  id=\"pic"+i+"\" style=\"cursor:hand\" onmouseover=\"swapEle()\" border=0></a></td>\n" +
			"      	</tr>\n" +
			"			</table>\n" +
			"		</td>\n" +
			"	</tr>\n" +
			"	<tr>\n" +
			"		<td align=\"left\" valign=\"top\" style=\"padding-left:1px;background:#C2C2C2\">\n" +
			"			<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" +
			"				<tr>\n" +
			"					<td id=\"menubg"+i+"\" style=\"background:none\"><img src=\"spacer.gif\" width=\"1\" height=\"3\"></td>\n" +
			"      	</tr>\n" +
			"			</table>\n" +
			"		</td>\n" +
			"	</tr>\n" +
			"</table>\n" +
			"</td>\n";
			
		}
		tempStr+=trailStr;
		tempStr+="<div id=\"secbox\" style=\"position:absolute;filter:alpha(opacity=0);left:0px;top:0px;width:550px\">";
		tempStr+="<table cellpadding=0 cellspacing=0 border=0>";
		tempStr+="<tr align=\"left\" valign=\"vailgn\">";
		tempStr+="<td id=\"secmenu\" class=\"white\">&nbsp;";
		tempStr+="</td>";
		tempStr+="</tr>";
		tempStr+="</table>";
		tempStr+="</div>";
		document.writeln(tempStr);
	}
