var w3c=(document.getElementById)? true:false;
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
var ie5=(w3c && ie)? true : false;
var ns6=(w3c && (navigator.appName=="Netscape"))? true: false;
var op8=(navigator.userAgent.toLowerCase().indexOf("opera")==-1)? false:true;
var currentX,currentY;
function GetXYWH(o)
{
	 var nLt=0;
	 var nTp=0;
	 var offsetParent = o;
	 while (offsetParent!=null && offsetParent!=document.body) 
	 {
		 nLt+=offsetParent.offsetLeft;
		 nTp+=offsetParent.offsetTop;
		 if(!ns6)
		 {
			 parseInt(offsetParent.currentStyle.borderLeftWidth)>0?nLt+=parseInt(offsetParent.currentStyle.borderLeftWidth):"";
			 parseInt(offsetParent.currentStyle.borderTopWidth)>0?nTp+=parseInt(offsetParent.currentStyle.borderTopWidth):"";
		 }
		 offsetParent=offsetParent.offsetParent;
	 }
	 currentX=nLt+3;	//调整子菜单与网页左侧的边距
	 currentY=nTp-7;	//调整子菜单与网页顶部的距离
}
function changeStyleMenu(obj,level,sStyle,oStyle)
{
	var pObj=obj.parentNode.parentNode;
	for(var j=0;j<pObj.childNodes.length;j++)
	{
	    for(var k=0;k<pObj.childNodes[j].childNodes.length;k++)
		{
	        var currentObj=pObj.childNodes[j].childNodes[k];
	        currentObj.className=oStyle;
	    }
	}
	obj.className=sStyle; 
}
function getCurrentLocation(){
    var t=document.getElementById("menubar");		//menubar:主菜单的表格ID
	GetXYWH(t);
}
function showMenu_m(divTag,xzb,yzb)
{
    if(xzb)
	{
        divTag.style.left=xzb;
        divTag.style.top=yzb;
    }
    divTag.style.visibility="visible";
}
function hideMenu_m(divTag)
{
    divTag.style.visibility="hidden";
}
function showMenuByName(name,index)
{
    getCurrentLocation();
	var offset=150;
	switch(index)
	{
		case 0: offset=0;break;				//调整子菜单与网页左侧的边距
		case 1: offset=15;break;			//调整子菜单与网页左侧的边距
		case 2: offset=80;break;			//调整子菜单与网页左侧的边距
		case 3: offset=150;break;			//调整子菜单与网页左侧的边距
		case 4: offset=216;break;			//调整子菜单与网页左侧的边距
		case 5: offset=287;break;			//调整子菜单与网页左侧的边距
		case 6: offset=382;break;			//调整子菜单与网页左侧的边距
		case 7: offset=476;break;			//调整子菜单与网页左侧的边距
		case 8: offset=570;break;			//调整子菜单与网页左侧的边距
	}
	var tag=document.getElementById(name);
	var tempX=currentX+offset;
	//var tempx=currentX+(offset*index);  
    var tempY=currentY+45;	//调整子菜单与网页顶部的距离
    showMenu_m(tag,tempX,tempY);
}
function hideMenuByName(name)
{
    var tag=document.getElementById(name);
    hideMenu_m(tag);
}
function showSubMenuDiv()
{
	document.write ('<DIV class=menuDiv id=dhmenu1 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu2 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu3 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD onmouseover=changeStyleMenu(this,2,"fontStyle","div.menuDiv td")><a href="show.asp?Depid=0&Menuid=22&SMenuid=22">子菜单一</a></TD></TR>');
    document.write ('<TR><TD><a href="show.asp?Depid=0&Menuid=22&SMenuid=23">子菜单二</a></TD></TR>');
    document.write ('<TR><TD><a href="show.asp?Depid=0&Menuid=22&SMenuid=24">子菜单三</a></TD></TR>');
    document.write ('<TR><TD><a href="show.asp?Depid=0&Menuid=22&SMenuid=25">子菜单四</a></TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu4 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu5 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu6 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu7 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
	
	document.write ('<DIV class=menuDiv id=dhmenu8 onmouseover=showMenu_m(this) style="Z-INDEX: 1; LEFT: 80px; TOP: 201px" onmouseout=hideMenu_m(this)>');
	document.write ('<TABLE cellSpacing=0 cellPadding=0 width=90 background="" border=0>');
  	document.write ('<TR><TD><TABLE width="100%"  border=0>');
    document.write ('<TR><TD>子菜单一</TD></TR>');
    document.write ('<TR><TD>子菜单二</TD></TR>');
    document.write ('<TR><TD>子菜单三</TD></TR>');
    document.write ('<TR><TD>子菜单四</TD></TR>');
	document.write ('</TABLE></TD></TR></TABLE></DIV>');
}
