Fetion.Web.Chat.defined("Fetion.Web.Chat.Op_Card");
Fetion.Web.Chat.Op_Card.create = function (o)
{
    var frm = Fetion.Web.Chat.newCtrl("cardfrm");
    frm.setSize(241);
    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" title="' + o.name + '" style="text-align:left">' + o.name + '</li>';
    html += '<li class="news_type" title="' + o.des+ '" style="text-align:left"><span>' + o.des + '</span></li>';
    html += '</ul>';
    frm.body.innerHTML = html;
    frm.img = frm.body.childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0];

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

    if (o.op != false)
    {
        frm.removeFootButton();
        if (!o.isFriend)
        {
            frm.addFootButton({
                title: "打开",
                data: o,
                onclick: function ()
                {
                    if((isIE&&window.event.button==1)||(!isIE&&window.event.button==0)){  
                        var data = this.data;
                        window.external.AddPubFeinno(data.opaccount, data.iduri, data.sid);
                    }
                }
            });
        }
        frm.addFootButton({
            title: "转发",
            data: o,
            onclick: function ()
            {
                if((isIE&&window.event.button==1)||(!isIE&&window.event.button==0)){  
                    var parent = frm.parentNode;
                    //window.external.ForwardingMsg(parent.id, parent.jsonStr);
					var p ;
						if(window.point){
							p = window.point;
						}else{
							p = mousePosition(window.event, null);
						}
					window.external.onClickMenu(parent.id,this.data.opaccount,p.y+10, p.x-10);
                  }
            }
        });
    }

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

    return frm;
};
Fetion.Web.Chat.Op_Card.update = function (ctrl, data)
{
    var parent = ctrl.img.parentNode;
	
    parent.innerHTML = "<img src='" + data.imgurl + "'>";
    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.AddPubFeinno(data.opaccount, data.iduri, data.sid);
    };
};
Fetion.Web.Chat.Op_Card.onerror = function ()
{
    this.style.width = this.style.height = "auto";
    this.style.marginTop = "17px";
    this.src = "chat/img/chat/LoadingImageFailed_s.png";
};