﻿var userCardIframe = null;
function showUserCard(id,cookroom_name)
{
    if(!id) return;
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
        //userCardIframe.style.width = '516px';
        //userCardIframe.style.height = '325px';
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
        //userCardIframe.frameborder='0';
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.width = "516px";
        document.body.appendChild(userCardIframe);
    }
    var addCrNameParameter = "";
    if(cookroom_name)
    {
        addCrNameParameter = "&cookroom_name="+encodeURI(cookroom_name);
    }
    userCardIframe.src = "user.aspx?id="+id+addCrNameParameter;
}
function jlzy(group_ID)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
      
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
       
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        //userCardIframe.style.backgroundColor = "#C1C1C1";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.width = "526px";
         userCardIframe.style.height = '444px';
        document.body.appendChild(userCardIframe);
    }
   
    userCardIframe.src = "encouragement.aspx?group_ID="+group_ID
}
function jlxz(group_ID)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
      
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
       
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.width = "526px";
         userCardIframe.style.height = '444px';
        document.body.appendChild(userCardIframe);
    }
   
    userCardIframe.src = "group_encouragement.aspx?group_ID="+group_ID
}
function gx_group(ca_id,cook_ids,food_id,id)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
      
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
       
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        //userCardIframe.style.backgroundColor = "#C1C1C1";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.width = "526px";
         userCardIframe.style.height = '454px';
        document.body.appendChild(userCardIframe);
    }
   
    if(food_id=="0")
    {
     userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&cook_ids="+cook_ids+"&&id="+id
    }
    if(cook_ids=="0")
    {
    userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&food_id="+food_id+"&&id="+id
    }
    if(food_id=="0"&&cook_ids=="0")
    {
    userCardIframe.src = "group_cashbox_money.aspx?ca_id="+ca_id+"&&id="+id
    }
   
}
//showmessages_group_p
function showmessages_group(cookroom_name)
{

    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
        userCardIframe.style.width = '544px';
        userCardIframe.style.height = '444px';
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
        //userCardIframe.frameborder='0';
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
       //userCardIframe.style.width = "554px";
        document.body.appendChild(userCardIframe);
    }
    var group = "";
    if(cookroom_name=="")
    {
    }
    else
    {
        group = cookroom_name;
        userCardIframe.src = "message.aspx?group="+group;
    }
   
}


function showmessages_group_p(cookroom_name)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
        userCardIframe.style.width = '544px';
        userCardIframe.style.height = '444px';
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
        //userCardIframe.frameborder='0';
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
       //userCardIframe.style.width = "554px";
        document.body.appendChild(userCardIframe);
    }
    var group = "";
    if(cookroom_name=="")
    {
    }
    else
    {
        groups = cookroom_name;
        userCardIframe.src = "message.aspx?groups="+groups;
    }
   
}

function showmessages(cookroom_name)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
        userCardIframe.style.width = '544px';
        userCardIframe.style.height = '444px';
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
        //userCardIframe.frameborder='0';
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
        userCardIframe.style.zIndex = 9999;
       //userCardIframe.style.width = "554px";
        document.body.appendChild(userCardIframe);
    }
    var name = "";
    if(cookroom_name="")
    {
//        if(group="")
//        {
//            userCardIframe.src = "message.aspx?groups="+groups;
//        }
//        else
//        {
//            userCardIframe.src = "message.aspx?group="+group;
//        }
    }
    else
    {
        name = cookroom_name;
        userCardIframe.src = "/message.aspx?name="+name;
    }
   
}

function friends(names)
{
    if(!userCardIframe)
    {
        try
        {
            userCardIframe = document.createElement("<iframe frameborder=0><iframe>");
        }
        catch(e)
        {
            userCardIframe = document.createElement("iframe");
        }
        var bodyWidth = document.body.clientWidth;
        var iframeLeft = Math.floor((bodyWidth - 516)/2);
        if(!iframeLeft) iframeLeft=120;
        
        
        userCardIframe.style.position = 'absolute';
        userCardIframe.style.left = iframeLeft+"px";
        userCardIframe.style.top = (document.documentElement.scrollTop+70)+"px";
        userCardIframe.style.width = '544px';
        userCardIframe.style.height = '444px';
        userCardIframe.style.overflow = "hidden";
        userCardIframe.scrolling='no';
        //userCardIframe.frameborder='0';
        userCardIframe.marginwidth="0";
        userCardIframe.framespacing="0";
        userCardIframe.marginheight="0";
        userCardIframe.style.borderStyle = "none";
       //userCardIframe.style.width = "554px";
        document.body.appendChild(userCardIframe);
    }
    var name = "";
    if(names)
    {
        name = names;
    }
    userCardIframe.src = "friends.aspx?name="+name+"&color=2009";
}


function closeUserCardWindow()//关闭用户名片窗口
{
    if(userCardIframe)
    {
        if(userCardIframe.parentNode)
        {
            window.setTimeout(function()
            {
                userCardIframe.parentNode.removeChild(userCardIframe);
                userCardIframe = null;
            },1);//新启线程进行关闭，否则会产生脚本错误。
        }
    }
}