Fetion.Web.Chat.defined("Fetion.Web.Chat.Group_Card");
Fetion.Web.Chat.Group_Card.create = function (o)
{
    var frm = Fetion.Web.Chat.newCtrl("cardfrm");
    frm.setSize(241, 105);
    frm.body.className = "con_pane mp_pd";
    var html = "";
    html += '<ul class="pic_news">';
    html += '<li class="pic_t mr_1">';
    html += '<div class="pic_box mp_wpic">';
    html += '<div class="pic_box_l_mp"></div>';
    html += '<div class="pic_box_m_mp" style="cursor:hand"><img src="chat/img/chat/LoadingImage_s.gif" style="width:auto;height:auto;margin-top:17px"/></div>';
    html += '<div class="pic_box_r_mp"></div>';
    html += '</div>';
    html += '</li>';
    html += '<li class="news_tit" style="text-align:left">' + o.name + '</li>';
    html += '<li class="news_type" style="text-align:left">群&nbsp;&nbsp;&nbsp;号：<span>' + o.sid + '</span></li>';
    html += '<li class="news_type" style="text-align:left">群分类：<span>' + o.phone + '</span></li>';
    html += '</ul>';
    frm.body.innerHTML = html;
    frm.img = frm.body.childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0];

    if (o.thumb)
        this.update(frm, o);

    if (o.op != false)
    {
        frm.removeFootButton();
        frm.addFootButton({
            title: "加入群",
            data: o,
            onclick: function ()
            {
                if((isIE&&window.event.button==1)||(!isIE&&window.event.button==0)){  
                    var data = this.data;
                    window.external.AddBuddy(data.sid || data.phone, data.name);
                }
            }
        });
        frm.addFootButton({
            title: "转发",
            data: o,
            onclick: function ()
            {
                if((isIE&&window.event.button==1)||(!isIE&&window.event.button==0)){  
                    var ctrl = this.ctrl;
                    var parent = ctrl.parentNode;
                    window.external.ForwardingMsg(parent.id, parent.jsonStr);
                }
            }
        });
    }

    if (o.parent)
        o.parent.appendChild(frm);

    return frm;
};
Fetion.Web.Chat.Group_Card.update = function (ctrl, data)
{
    var parent = ctrl.img.parentNode;
    parent.innerHTML = "<img src='" + data.thumb + "'>";
    ctrl.img = parent.childNodes[0];
    ctrl.img.onerror = this.onerror;

    if (data.op == false)
        return;

    ctrl.img.data = data;
    ctrl.img.onclick = function ()
    {
        var data = this.data;
        window.external.LClick(data.type, data.texturl, "");
    };
};
Fetion.Web.Chat.Group_Card.onerror = function ()
{
    this.style.width = this.style.height = "auto";
    this.style.marginTop = "17px";
    this.src = "chat/img/chat/LoadingImageFailed_s.png";
};