﻿// JScript 文件
    var x0=0,y0=0,x1=0,y1=0;
    var moveable=false;
    var normal = "";
    var hover='orange',normal='#336699';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
        if(event.button==1)
        {
            //锁定标题栏;
            obj.setCapture();
            //定义对象;
            var win = obj.parentNode;
            //记录鼠标和层位置;
            x0 = event.clientX;
            y0 = event.clientY;
            x1 = parseInt(win.style.left);
            y1 = parseInt(win.style.top);
            //记录颜色;
            normal = win.style.backgroundColor;
            //改变风格;
//            obj.style.backgroundColor = hover;
            win.style.borderColor = hover;
//            obj.nextSibling.style.color = hover;
            moveable = true;
        }
    }
    //拖动;
    function drag(obj)
    {
        if(moveable)
        {
            var win = obj.parentNode;
//            var sha = win.nextSibling;
            win.style.left = x1 + event.clientX - x0;
            win.style.top = y1 + event.clientY - y0;
//            sha.style.left = parseInt(win.style.left) + offx;
//            sha.style.top = parseInt(win.style.top) + offy;
        }
    }
    //停止拖动;
    function stopDrag(obj)
    {
        if(moveable)
        {
            var win = obj.parentNode;
//            var sha = win.nextSibling;
            var msg = obj.nextSibling;
            win.style.borderColor = normal;
//            obj.style.backgroundColor = normal;
            msg.style.color = normal;
//            sha.style.left = obj.parentNode.style.left;
//            sha.style.top = obj.parentNode.style.top;
            obj.releaseCapture();
            moveable = false;
        }
    }
    function ShutChat()
    {
        var oDivParent = document.getElementById("chatroom");
        var oDivChild = document.getElementById("chatcontent");
        oDivChild.innerHTML = "";
        oDivParent.style.display = "none";
    }
    function OpenChatRoom()
      {
          var oDiv = document.getElementById("chatcontent");
          oDiv.innerHTML = "<iframe src=\"ChartRoom/index.htm\" frameborder=\"0\" width=\"440px\" height=\"440px\" scrolling=\"no\"></iframe>";
//          oDiv.innerHTML = "<iframe src=\"ChartRoom/index.htm\" frameborder=\"0\" width=\"440px\" height=\"440px\"></iframe>";
          oDiv.parentNode.style.display = "block";
          LocationChat();
      }
      function LocationChat(){
        document.getElementById("chatroom").style.top=
            document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("chatroom").offsetHeight)/2
        document.getElementById("chatroom").style.left=
            document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("chatroom").offsetWidth)/2;
      }
      function LocationChatIcon(){
//        document.getElementById("chaticon").style.top=
//            document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("chaticon").offsetHeight-3;
            if(document.getElementById("chaticon"))
            {
                document.getElementById("chaticon").style.top=
                    document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("chaticon").offsetHeight)/2
                document.getElementById("chaticon").style.left=
                    document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("chaticon").offsetWidth-5;
            }
        }
      function LocationChat1(){
//        document.getElementById("chatroom").style.top=
//            document.documentElement.scrollTop;
//        document.getElementById("chatroom").style.left=
//            document.documentElement.scrollLeft;
      }
      function Check_Press()
      {
          if (window.event.keyCode==13) 
          {
              event.returnValue = false;
          }
      }