
  /**
  * 重新登录
  */
  function loginOut() {

     var sFeatures = "toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, "
        + "location=yes, status=yes,titlebar=yes, width=" + (screen.availWidth-10) + ", "
        + "height=" + (screen.availHeight-150) + ", top=0, left=0";
    /*
    var menuBar=getObject(window.top,'menuBar');
    menuBar.activeChild.hideMenu();
    */
    //打开窗口true,null,object , 未登录直接在url请求栏中输入动作, 提示重新登录      ok
    if (self.parent == self && self.opener == null && self.dialogArguments == null) {//未打开主页面
      window.open("loginOut.system", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //点击了菜单上的重新登录菜单  ok
    if (self.name.substring(0, 4) == 'main') {//如果是主窗口
      window.open("loginOut.system", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //服务器重启或登录超时(未open和dialogArguments 窗口)    ok
    if (self.parent != self && self.opener == null && self.dialogArguments == null) {//主窗口中的页面
      window.open("loginOut.system", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //服务器重启或登录超时(打开dialogArguments) 窗口
    if (self.parent == self && self.opener == null && self.dialogArguments != null) {//模态窗口

      var win = self.dialogArguments;
      self.top.close();

      window.open("loginOut.system", null, sFeatures);
      win.top.opener=null;
      win.top.close();
      return;
    }

    //服务器重启或登录超时(打开open窗口 )
    if (self.parent == self && self.opener != null && self.dialogArguments == null) {//打开窗口
      if (self.opener.closed) {//未打开主页面
        window.open("loginOut.system", null, sFeatures);
        self.top.opener=null;
        self.top.close();
        return;
      }
      else {
        var win = null;
        var winClose = self;
        do{
          win = winClose.opener;
          winClose.opener = null;
          winClose.close();
          winClose = win;
        }
        while (win.name != 'work' && win.name.substring(0, 4) != 'main')
        window.open("loginOut.system", null, sFeatures);
        win.top.opener=null;
        win.top.close();
        return;
      }
    }
       }


  /*
  * 退出系统
  */
  function exit(usercode){
//    var menuBar=getObject('menuBar');
//    if(menuBar!=null){
//      if(menuBar.activeChild!=null){
//        menuBar.activeChild.hideMenu();
//      }
//    }
      if(confirm("确认要退出本系统？")){
     var sFeatures = "toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, "
        + "location=yes, status=yes,titlebar=yes, width=" + (screen.availWidth-10) + ", "
        + "height=" + (screen.availHeight-150) + ", top=0, left=0";
    /*
    var menuBar=getObject(window.top,'menuBar');
    menuBar.activeChild.hideMenu();
    */
    //打开窗口true,null,object , 未登录直接在url请求栏中输入动作, 提示重新登录      ok
    if (self.parent == self && self.opener == null && self.dialogArguments == null) {//未打开主页面
      window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //点击了菜单上的重新登录菜单  ok
    if (self.name.substring(0, 4) == 'main') {//如果是主窗口
      window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //服务器重启或登录超时(未open和dialogArguments 窗口)    ok
    if (self.parent != self && self.opener == null && self.dialogArguments == null) {//主窗口中的页面
      window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
      self.top.opener=null;
      self.top.close();
      return;
    }

    //服务器重启或登录超时(打开dialogArguments) 窗口
    if (self.parent == self && self.opener == null && self.dialogArguments != null) {//模态窗口

      var win = self.dialogArguments;
      self.top.close();

      window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
      win.top.opener=null;
      win.top.close();
      return;
    }

    //服务器重启或登录超时(打开open窗口 )
    if (self.parent == self && self.opener != null && self.dialogArguments == null) {//打开窗口
      if (self.opener.closed) {//未打开主页面
        window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
        self.top.opener=null;
        self.top.close();
        return;
      }
      else {
        var win = null;
        var winClose = self;
        do{
          win = winClose.opener;
          winClose.opener = null;
          winClose.close();
          winClose = win;
        }
        while (win.name != 'work' && win.name.substring(0, 4) != 'main')
        window.open("loginOut.system?usercode="+usercode+"", null, sFeatures);
        win.top.opener=null;
        win.top.close();
        return;
      }
    }
       }
  }

  /*
  * 菜单执行动作
  */
  function menuRun(url,moedelid){
   url=url+"?urlid="+moedelid+""
   link(url,'moduleFrame');
  }


  /*
  * 关于
  */
  function about(){
    var menuTree=getObject('menuTree');
    var menuBar=getObject('menuBar');
    var objEvent=window.event.srcElement;
    if(menuTree!=null&&menuTree.contains(objEvent)){
      menuTree.selectItem(objEvent);
    }
    if(menuBar!=null){
      if(menuBar.activeChild!=null){
        menuBar.activeChild.hideMenu();
      }
      if(menuTree!=null&&!menuTree.contains(objEvent)){
          while(objEvent.tagName!="TR"){
            objEvent=objEvent.parentElement;
          }
          var id=objEvent.id.substring(1);
          menuTree.selectItem(getObject(id));
      }
    }
    modalWindow('about.system',400,300);
//    window.frames["work"].openVirtualWindow('about.system',400,300);
  }

  function guide(){
    var menuTree=getObject('menuTree');
    var menuBar=getObject('menuBar');
    var objEvent=window.event.srcElement;
    if(menuTree!=null&&menuTree.contains(objEvent)){
      menuTree.selectItem(objEvent);
    }
    if(menuBar!=null){
      if(menuBar.activeChild!=null){
        menuBar.activeChild.hideMenu();
      }
      if(menuTree!=null&&!menuTree.contains(objEvent)){
          while(objEvent.tagName!="TR"){
            objEvent=objEvent.parentElement;
          }
          var id=objEvent.id.substring(1);
          menuTree.selectItem(getObject(id));
      }
    }
   //link('usercash/handbook.doc');
  }
  /*
  * 检测登录
  */
  function checkLogin(postBlank) {

    if (checkEmpty('loginUser_Code', '请输入用户名')) return;
    if (checkEmpty('loginUser_Passwrod', '请输入密码')) return;

    if (postBlank) {
      window.opener=null;
      window.open("","_self");
      window.close();
      var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
          + "location=no, status=no,titlebar=no, width=" + (screen.width - 10) + ", "
          + "height=" + (screen.height - 60) + ", top=0, left=0";
      var winName = 'main' + randomNum();
      window.open("about:blank", winName, sFeatures);
      var loginForm = getForm(0)
      loginForm.target = winName;
      loginForm.submit();
//      self.opener = null;
//      self.close();
    }
    else {
      var loginForm = getForm(0)
      loginForm.submit();
 }
  }
  function EnterSubmit(postBlank){
          var _key;
          document.onkeyup = function(e){
              if (e == null) { // ie
                  _key = event.keyCode;
              } else { // firefox
                  _key = e.which;
              }

              if(_key == 13){
                  checkLogin(postBlank);
              }
          }
      }

  /*
  * 提交登录
  */
  function postLogin(obj, postBlank) {
    var gk = event.keyCode;
    var checkCode = getObject('charRandomCode');
    if (gk == 13) {
      if(checkCode==null||checkCode.type=='hidden'){
        if (obj.name == 'loginPassword') {
          checkLogin(postBlank);
        }
        else if(obj.name == 'loginUserCode'){
          getObject('loginPassword').select();
        }
      }
      else{
        if (obj.name == 'charRandomCode') {
          checkLogin(postBlank);
        }
        else if(obj.name == 'loginUserCode') {
          getObject('loginPassword').select();
        }
        else if(obj.name == 'loginPassword'){
          getObject('charRandomCode').select();
        }
      }
    }
  }


function showHiddenLeftTree(object){
  setMouseOutStyle(object);

  var str=object.innerText;

  if(str==3){
    object.innerText=4;
    getObject("leftTree").style.display="none";
  }
  else{
    object.innerText=3;
    getObject("leftTree").style.display="block";
  }
}

function setMouseOverStyle(object){
//  object.style.color='#FF0000';
//  object.style.backgroundColor="#FFFFFF";
  object.style.borderRight = "#2c59aa 1px solid";
  object.style.borderTop = "#2c59aa 1px solid";
  object.style.borderLeft = "#2c59aa 1px solid";
  object.style.borderBottom = "#2c59aa 1px solid";
  object.style.cursor = "hand";
  object.style.color = "red";
  object.style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#A6C8EE, EndColorStr=#A6C8EE)";

}

function setMouseOutStyle(object){
//  object.style.color='#000000';
//  object.style.backgroundColor="#CCCCCC";
  object.bgcolor ="#CCCCCC";

  object.style.borderRight = "#2c59aa 1px solid";
  object.style.borderTop = "#2c59aa 1px solid";
  object.style.borderLeft = "#2c59aa 1px solid";
  object.style.borderBottom = "#2c59aa 1px solid";
  object.style.cursor = "hand";
  object.style.color = "blue";
  object.style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA)";
}