﻿// JScript 文件

var clocktext;
var pagetitle = document.title;
function scroll() {
var today = new Date();
var sec = today.getSeconds();
var hr = today.getHours();
var min = today.getMinutes();
if (hr <= 9) hr = "0" + hr;
if (min <= 9) min = "0" + min;
if (sec <= 9) sec = "0" + sec;
var clocktext = hr + ":" + min + ":" + sec;
clocktimer = setTimeout("scroll()", 1000);
em('date1').innerHTML=clocktext;
}
if (document.all) "scroll()";

//首先定义两个数组，一个是菜单文字，一个是链接
var MenuText = new Array(10);
var MenuEven = new Array(10);
MenuText[1] = ["查看订单","我的订单"];
MenuText[2] = ["菜单21","菜单21"];
MenuText[3] = ["菜单31","菜单321","菜单33"];

MenuEven[1] = ["/login/jetblue/OrderList2.aspx","/login/jetblue/ClientGoods.aspx"];
MenuEven[2] = ["url21","url22"];
MenuEven[3] = ["url31","url32","url33"];

//初始化一个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)+20; 
var top = getTopIE(node,true)+28;
//定义打开的oPopup的宽度，高度
var width = 90;
var height = MenuText[t].length*23; 
//清空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;' border=0 cellspacing=1 cellpadding=3 >");
for(var i=0;i<MenuText[t].length;i++)
{
oPopup.document.write("<tr><td background='/login/iamge/ds4.gif' bgcolor=cdddf4 style='border-top : cdddf4 1px solid;border-bottom : #666666 1px solid;border-left : cdddf4 1px solid;border-right : #666666 1px solid;mouse : hand; font-size : 12px; color:#000000;text-align : left;vertical-align : center;CURSOR: hand' onmouseover=this.bgColor='#C2D2E5'; onmouseout=this.bgColor='cdddf4'; height='20' onclick='parent.parent.mainFrame.location.href=\""+MenuEven[t][i]+"\"';>"+MenuText[t][i]+"</td></tr>");
}
oPopup.document.write("</td></tr></table>");
oPopup.document.write("</body>")
}
//top显示隐藏
function shtop(){
 if (document.getElementById("toptab").style.display=="none"){
 parent.full.rows="72,*,"+parent.full.rows.split(",")[2]
   document.getElementById("zd3").style.display=""
   document.getElementById("toptab").style.display=""
  document.getElementById("zd4").style.display="none"
  //document.getElementById("shtop").value="隐藏上部";
 }
 else{
  parent.full.rows="30,*,"+parent.full.rows.split(",")[2]
  //document.getElementById("shtop").value="显示上部";
  document.getElementById("zd3").style.display="none"
   document.getElementById("toptab").style.display="none"
  document.getElementById("zd4").style.display=""
 }
}
function shleft(){
 if (parent.cen.cols=="0,*"){
  parent.cen.cols="166,*,"
  //document.getElementById("shleft").value="隐藏左部";
  document.getElementById("zd1").style.display=""
  document.getElementById("zd2").style.display="none"
 }
 else{
  parent.cen.cols="0,*"
  //document.getElementById("shleft").value="显示左部";
   document.getElementById("zd1").style.display="none"
  document.getElementById("zd2").style.display=""
 }
}

