Fetion.Web.Chat.defined("Fetion.Web.Chat.Out_Card");
Fetion.Web.Chat.Out_Card.create = function(o) {
    var frm = Fetion.Web.Chat.newCtrl("cardfrm");
    frm.setSize(294);
    var desc = Fetion.Web.Chat.split(o.desc, 12 * 3);
    var html = "";
    html += '<ul class="pic_news">';
    html += '<li class="pic_t">';
    html += '<div class="pic_box">';
    html += '<div class="pic_box_l"></div>';
    html += '<div class="pic_box_m" style="cursor:hand"><img src="chat/img/chat/LoadingImage_s.gif" style="width:auto;height:auto;margin-top:27px"/></div>';
    html += '<div class="pic_box_r"></div>';
    html += '</div>';
    html += '</li>';
    html += '<li class="news_tit" style="cursor:hand;text-align:left" title="' + o.name + '">' + o.name + '</li>';
    html += '<li class="news_inf" style="cursor:hand;text-align:left" title="' + o.desc + '">' + desc + '</li>';
    html += '</ul>';
    frm.body.innerHTML = html;
    frm.img = frm.body.childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0];
    frm.div = frm.img.parentNode;
    frm.titl = frm.body.childNodes[0].childNodes[1];
    frm.desc = frm.body.childNodes[0].childNodes[2];
    frm.div.data = frm.titl.data = frm.desc.data = o;
    frm.div.onclick = frm.titl.onclick = frm.desc.onclick = function() 
    { 
            var data = this.data;
            if (data.source == "身边")
                window.external.AroundCardClick(data.url);
            else
                window.external.LClick(data.type, data.url, "");
    };
    frm.addFootText("<span title='来自" + o.source + "'>来自" + o.source + "</span>");

    if (o.source == "身边" && !o.path)
        o.path = "chat/img/chat/out_card_sb.png";

    if (o.path&&o.path!="thumb load error, no thumb field"&&o.path!="null"){
        this.update(frm, o);
	}else{
		frm.img.src="chat/img/chat/no_pic.png";
	}

    if (o.op != false) {
        frm.addFootButton({
            title: "打开",
            data: o,
            onclick: function() {
                if((isIE&&window.event.button==1)||(!isIE&&window.event.button==0)){  
                    frm.img.click();
                }
            }
        });
        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);
					//window.external.onClickMenu(parent.id, parent.jsonStr, point.y+10, point.x-10);
                }
            }
        });
    }

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

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

    if (data.op == false)
    {
        ctrl.div.onclick = ctrl.titl.onclick = ctrl.desc.onclick = null;
        ctrl.div.style.cursor = ctrl.titl.style.cursor = ctrl.desc.style.cursor = "default";
        return;
    }
};
Fetion.Web.Chat.Out_Card.onerror = function ()
{
    this.style.width = this.style.height = "auto";
    this.style.marginTop = "27px";
    this.src = "chat/img/chat/LoadingImageFailed_s.png";
};