﻿// JScript 文件
var IsLmVisible = false;

if(typeof(getWindowInfo) == "undefined")
var getWindowInfo = function()
{
    var scrollX=0,scrollY=0,width=0,height=0,contentWidth=0,contentHeight=0;
    if(typeof(window.pageXOffset)=='number')
    {
        scrollX=window.pageXOffset;
        scrollY=window.pageYOffset;
    }
    else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
    {
        scrollX=document.body.scrollLeft;
        scrollY=document.body.scrollTop;
    }
    else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
    {
        scrollX=document.documentElement.scrollLeft;
        scrollY=document.documentElement.scrollTop;
    }
    if(typeof(window.innerWidth)=='number')
    {
        width=window.innerWidth;
        height=window.innerHeight;
    }
    else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
    {
        width=document.documentElement.clientWidth;
        height=document.documentElement.clientHeight;
    }
    else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
    {
        width=document.body.clientWidth;
        height=document.body.clientHeight;
    }
    if(document.documentElement&&(document.documentElement.scrollHeight||document.documentElement.offsetHeight))
    {
        if(document.documentElement.scrollHeight>document.documentElement.offsetHeight)
        {
            contentWidth=document.documentElement.scrollWidth;
            contentHeight=document.documentElement.scrollHeight;
        }
        else
        {
            contentWidth=document.documentElement.offsetWidth;
            contentHeight=document.documentElement.offsetHeight;
        }
    }
    else if(document.body&&(document.body.scrollHeight||document.body.offsetHeight))
    {
        if(document.body.scrollHeight>document.body.offsetHeight)
        {
            contentWidth=document.body.scrollWidth;
            contentHeight=document.body.scrollHeight;
        }
        else
        {
        contentWidth=document.body.offsetWidth;
        contentHeight=document.body.offsetHeight;
        }
    }
    else
    {
        contentWidth=width;
        contentHeight=height;
    }
    if(height>contentHeight)
        height=contentHeight;
    if(width>contentWidth)
        width=contentWidth;
    var rect=new Object();
    rect.ScrollX=scrollX;
    rect.ScrollY=scrollY;
    rect.Width=width;
    rect.Height=height;
    rect.ContentWidth=contentWidth;
    rect.ContentHeight=contentHeight;
    return rect;
}


function Lm_ScrollWindow()
{
    if(!IsLmVisible)
        return;
    document.getElementById("Div_Message_Window").style.top = 50 + document.documentElement.scrollTop + "px";
    
}

function LeaveMessage(UserName, Chat_Class, Init_Info, param)
{
    if(Init_Info==5)
    {
        var url="myqq.aspx?ltdusername="+ UserName +"&Msg_Class="+ Chat_Class ;
        window.open(url, 'newwindow', 'height=500, width=900,top=200, toolbar=no, menubar=no, scrollbars=auto, resizable=no, location=no, status=no');  
        
        return ;
    }
    window.onscroll = Lm_ScrollWindow;
    IsLmVisible = true;
    
    var Message_Window = document.getElementById("Div_Message_Window");
    var bExistBefore = document.getElementById("Div_New_Insert");
    if(bExistBefore != null)
        document.body.removeChild(bExistBefore);
    var Div_To_Insert = document.createElement("div");
    Div_To_Insert.id = "Div_New_Insert";
    Div_To_Insert.style.position = "absolute";
    Div_To_Insert.style.left = "0px";
        Div_To_Insert.style.top = "0px";         
    Div_To_Insert.style.width = document.body.clientWidth + "px";
    Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
    var ww=getWindowInfo();
    var wdi=ww.Width;
    var hei=ww.Height;
    var dw=document.body.clientWidth;
    var dh=document.body.clientHeight ;
    if(document.body.clientWidth < getWindowInfo().Width)
        Div_To_Insert.style.width = getWindowInfo().Width + "px";
    if(document.body.clientHeight < getWindowInfo().Height)
        Div_To_Insert.style.height = getWindowInfo().Height + "px";
    if(document.body.clientHeight<document.body.scrollHeight)
    {
        Div_To_Insert.style.height=document.body.scrollHeight+"px";
        //document.documentElement.scrollHeight=document.body.scrollHeight;
        //document.documentElement.offsetHeight = document.body.scrollHeight;
    }
    Div_To_Insert.style.zIndex = 5;
    Div_To_Insert.style.backgroundColor = "#213039";
    Div_To_Insert.style.filter = "alpha(opacity=70)";
    document.body.appendChild(Div_To_Insert);
    if(Message_Window != null)
    {
        Message_Window.style.display = "block";
        Lm_ScrollWindow();
        return;
    }
    

    
    var ThisWidth = 900;
    var div = document.createElement("div");
    div.id = "Div_Message_Window";
    div.style.cssText = "position:absolute;top:" + (50 + document.documentElement.scrollTop) + "px;left:" + ((getWindowInfo().Width - ThisWidth)/2) + "px;z-index:10;border:solid 1px #C0C0C0;";
    var InnerCode;
    var initinfo = "";
    if(arguments.length == 4)
    {
        if(Init_Info == 1)
        {
            initinfo = "&initinfo=1&param=" + param;
        }
        
        if(Init_Info == 2)
        {
            initinfo = "&initinfo=2&param=" + param;
        }
        
        if(Init_Info == 3)
        {
            initinfo = "&initinfo=3&param=" + param;
        }
        
        if(Init_Info == 4)
        {
            initinfo = "&initinfo=4&param=" + param;
        }
        
    }
    InnerCode = "<iframe src=\"myqq.aspx?ltdusername=" + UserName + "&Msg_Class=" + Chat_Class + initinfo + "\" frameborder=\"0\" style=\"width:" + ThisWidth + "px;height:500px;\">";
    InnerCode += "</iframe>";
    div.innerHTML = InnerCode;
    document.body.appendChild(div);
}
function sendRcinfo(uanme,type,id)
{
     window.onscroll = Lm_ScrollWindow;
    IsLmVisible = true;
    
    var Message_Window = document.getElementById("Div_Message_Window");
    var bExistBefore = document.getElementById("Div_New_Insert");
    if(bExistBefore != null)
        document.body.removeChild(bExistBefore);
    var Div_To_Insert = document.createElement("div");
    Div_To_Insert.id = "Div_New_Insert";
    Div_To_Insert.style.position = "absolute";
    Div_To_Insert.style.left = "0px";
        Div_To_Insert.style.top = "0px";         
    Div_To_Insert.style.width = document.body.clientWidth + "px";
    Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
    var ww=getWindowInfo();
    var wdi=ww.Width;
    var hei=ww.Height;
    var dw=document.body.clientWidth;
    var dh=document.body.clientHeight ;
    if(document.body.clientWidth < getWindowInfo().Width)
        Div_To_Insert.style.width = getWindowInfo().Width + "px";
    if(document.body.clientHeight < getWindowInfo().Height)
        Div_To_Insert.style.height = getWindowInfo().Height + "px";
    if(document.body.clientHeight<document.body.scrollHeight)
    {
        Div_To_Insert.style.height=document.body.scrollHeight+"px";
        //document.documentElement.scrollHeight=document.body.scrollHeight;
        //document.documentElement.offsetHeight = document.body.scrollHeight;
    }
    Div_To_Insert.style.zIndex = 5;
    Div_To_Insert.style.backgroundColor = "#213039";
    Div_To_Insert.style.filter = "alpha(opacity=70)";
    document.body.appendChild(Div_To_Insert);
    if(Message_Window != null)
    {
        Message_Window.style.display = "block";
        Lm_ScrollWindow();
        return;
    }
    

    
    var ThisWidth = 900;
    var div = document.createElement("div");
    div.id = "Div_Message_Window";
    div.style.cssText = "position:absolute;top:" + (50 + document.documentElement.scrollTop) + "px;left:" + ((getWindowInfo().Width - ThisWidth)/2) + "px;z-index:10;border:solid 1px #C0C0C0;";
    var InnerCode;
    if(id==''|| id=="undefined")
    {
    InnerCode = "<iframe src=\"rcsendmessage.aspx?uname=" + uanme + "&type=" +type + "\" frameborder=\"0\" style=\"width:" + ThisWidth + "px;height:500px;\">";
    InnerCode += "</iframe>";
    }
    else
    {
    InnerCode = "<iframe src=\"rcsendmessage.aspx?uname=" + uanme + "&type=" +type + "&id="+id+"\" frameborder=\"0\" style=\"width:" + ThisWidth + "px;height:500px;\">";
    InnerCode += "</iframe>";
    }
    div.innerHTML = InnerCode;
    document.body.appendChild(div);
}
function showMessage(username,Rid)
{
    window.onscroll = Lm_ScrollWindow;
    IsLmVisible = true;
    
    var Message_Window = document.getElementById("Div_Message_Window");
    var bExistBefore = document.getElementById("Div_New_Insert");
    if(bExistBefore != null)
        document.body.removeChild(bExistBefore);
    var Div_To_Insert = document.createElement("div");
    Div_To_Insert.id = "Div_New_Insert";
    Div_To_Insert.style.position = "absolute";
    Div_To_Insert.style.left = "0px";
        Div_To_Insert.style.top = "0px";         
    Div_To_Insert.style.width = document.body.clientWidth + "px";
    Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
    if(document.body.clientWidth < getWindowInfo().Width)
        Div_To_Insert.style.width = getWindowInfo().Width + "px";
    if(document.body.clientHeight < getWindowInfo().Height)
        Div_To_Insert.style.height = getWindowInfo().Height + "px";
    Div_To_Insert.style.zIndex = 5;
    Div_To_Insert.style.backgroundColor = "#FFFFFF";
    Div_To_Insert.style.filter = "alpha(opacity=70)";
    document.body.appendChild(Div_To_Insert);
    if(Message_Window != null)
    {
        Message_Window.style.display = "block";
        Lm_ScrollWindow();
        return;
    }    
    var ThisWidth = 680;
    var div = document.createElement("div");
    div.id = "Div_Message_Window";
    div.style.cssText = "position:absolute;top:" + (50 + document.documentElement.scrollTop) + "px;left:" + ((getWindowInfo().Width - ThisWidth)/2) + "px;z-index:10;border:solid 1px #C0C0C0;";
    var InnerCode;
    
    InnerCode = "<iframe src=\"showMessage.aspx?username=" + username + "&Rid=" + Rid + "\" frameborder=\"0\" style=\"width:" + ThisWidth + "px;height:475px;\">";
    InnerCode += "</iframe>";
    div.innerHTML = InnerCode;
    document.body.appendChild(div);
}
function LeaveMessage2(UserName, Chat_Class, Init_Info, param)
{
    window.onscroll = Lm_ScrollWindow;
    IsLmVisible = true;
    
    var Message_Window = document.getElementById("Div_Message_Window");
    var bExistBefore = document.getElementById("Div_New_Insert");
    if(bExistBefore != null)
        document.body.removeChild(bExistBefore);
    var Div_To_Insert = document.createElement("div");
    Div_To_Insert.id = "Div_New_Insert";
    Div_To_Insert.style.position = "absolute";
    Div_To_Insert.style.left = "0px";
        Div_To_Insert.style.top = "0px";         
    Div_To_Insert.style.width = document.body.clientWidth + "px";
    Div_To_Insert.style.height = document.body.clientHeight + 50 + "px";
    if(document.body.clientWidth < getWindowInfo().Width)
        Div_To_Insert.style.width = getWindowInfo().Width + "px";
    if(document.body.clientHeight < getWindowInfo().Height)
        Div_To_Insert.style.height = getWindowInfo().Height + "px";
    Div_To_Insert.style.zIndex = 5;
    Div_To_Insert.style.backgroundColor = "#FFFFFF";
    Div_To_Insert.style.filter = "alpha(opacity=70)";
    document.body.appendChild(Div_To_Insert);
    if(Message_Window != null)
    {
        Message_Window.style.display = "block";
        Lm_ScrollWindow();
        return;
    }
    

    
    var ThisWidth = 900;
    var div = document.createElement("div");
    div.id = "Div_Message_Window";
    div.style.cssText = "position:absolute;top:" + (50 + document.documentElement.scrollTop) + "px;left:" + ((getWindowInfo().Width - ThisWidth)/2) + "px;z-index:10;border:solid 1px #C0C0C0;";
    var InnerCode;
    var initinfo = "";
    if(arguments.length == 4)
    {
        if(Init_Info == 1)
        {
            initinfo = "&initinfo=1&param=" + param;
        }
        
        if(Init_Info == 2)
        {
            initinfo = "&initinfo=2&param=" + param;
        }
        
        if(Init_Info == 3)
        {
            initinfo = "&initinfo=3&param=" + param;
        }
        
        if(Init_Info == 4)
        {
            initinfo = "&initinfo=4&param=" + param;
        }
    }
    InnerCode = "<iframe src=\"../../myqq.aspx?beserver=true&ltdusername=" + UserName + "&Msg_Class=" + Chat_Class + initinfo + "\" frameborder=\"0\" style=\"width:" + ThisWidth + "px;height:500px;\">";
    InnerCode += "</iframe>";
    div.innerHTML = InnerCode;
    document.body.appendChild(div);
}

function ShutDownMessageWindow()
{
    var Message_Window = document.getElementById("Div_Message_Window");
    
    
    if(Message_Window == null)
        return;
     //Message_Window.style.display = "none";//隐藏
    document.body.removeChild(Message_Window);//删除
    
    if(document.getElementById("Div_New_Insert") != null)
        document.body.removeChild(document.getElementById("Div_New_Insert"));
    IsLmVisible = false;
    
}
