//首先定义两个数组，一个是菜单文字，一个是链接
var MenuText = new Array(6);
var MenuEven = new Array(6);
MenuText[1] = ["中心简介","医院历程","文化活动","光荣榜"];
MenuText[2] = ["耳科","鼻科","咽喉科","头颈外科","鼻咽癌","睡眠呼吸","中医科","整形外科","听力中心"];
MenuText[3] = ["新闻动态","视听前沿"];
MenuText[4] = ["专家介绍","专家答疑"];
MenuText[5] = ["专家答疑 ","患者心声"];
MenuText[6] = ["治疗范围","就诊流程","诊疗设备","就医环境"];
    
MenuEven[1] = ["../../aboutus.html","../../history.html","../../activities/index.html","../../guangrongbang.html"];
MenuEven[2] = ["../../tesezhuanke/erke/index.html","../../tesezhuanke/bike/index.html","../../tesezhuanke/yanhouke/index.html","../../tesezhuanke/toujingwaike/index.html","../../tesezhuanke/biyanai/index.html","../../tesezhuanke/shuimianhuxi/html","../../tesezhuanke/zhongyike/index.html","../../tesezhuanke/zhengxingwaike/index.html","../../tesezhuanke/xinshengertingli/index.html"];
MenuEven[3] = ["../../news/index.html","../../video/index.html"];
MenuEven[4] = ["../../doctor/index.html","../../bbs/index.php"];
MenuEven[5] = ["../../bbs/index.php","../../bbs/index.php"];
MenuEven[6] = ["../../fanwei.html","../../liucheng.html","../../photo/plant/index.html","../../photo/environment/index.html"];
    
    
//初始化一个oPopup对象

var  oPopup = window.createPopup();

//这两个是获得表格绝对位置的方法，很有用的说
function getLeftIE(x,m) {
  var dx=0;
  if (x.tagName=="TD"){
    dx=x.offsetLeft;
  }
  else if (x.tagName=="TABLE") {
    dx=x.offsetLeft;
    if (m) { dx+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dx+(x.parentElement.tagName=="BODY"?0:getLeftIE(x.parentElement,m));
}
function getTopIE(x,m) {
  var dy=0;
  if (x.tagName=="TR"){
    dy=x.offsetTop;
  }
  else if (x.tagName=="TABLE") {
    dy=x.offsetTop;
    if (m) { dy+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dy+(x.parentElement.tagName=="BODY"?0:getTopIE(x.parentElement,m));
}

//显示菜单
function ButtonClick(node,t)
{   
   //首先得到鼠标所在的表格的位置
    var left = getLeftIE(node,true)-8;  
    var top = getTopIE(node,true)+30;
//定义打开的oPopup的宽度，高度
    var width = MenuText[t].length*55;
    var height = 20;    
//清空oPopup的内容，否则每次调用都只会在后面接着写
    oPopup.document.body.innerHTML = "";
    var oPopBody = oPopup.document.body;
    oPopup.show(left,top, width, height, document.body);      
        oPopup.document.open;
//让oPopup在鼠标离开时自动隐藏。
        oPopup.document.write("<body leftmargin=0 topmargin=0 scroll=no style='border : 0 px;' onmouseover=clearTimeout(parent.popt); onmouseout=parent.popt=setTimeout('parent.oPopup.hide()',10);>");

//用document.write()写菜单内容
        oPopup.document.write("<table width=100% height=100% style='border-collapse : collapse;'><tr>");
    for(var i=0;i<MenuText[t].length;i++)
        {
        oPopup.document.write("<td bgcolor=#0F9E54 style='border-top : #0F9E54 1px solid;border-bottom : #0F9E54 1px solid;border-left : #0F9E54 1px solid;border-right : #0F9E54 1px solid;mouse : hand; font-size : 12px; color:#FFFFFF;text-align :center;vertical-align : center;CURSOR: hand' onmouseover=this.bgColor='#0F9E54'; onmouseout=this.bgColor='#0F9E54'; height='20' onclick='parent.location.href=\""+MenuEven[t][i]+"\"';>"+MenuText[t][i]+"</td>");
        }
        oPopup.document.write("</tr></table></td></tr></table>");
        oPopup.document.write("</body>")
}