Fetion.Web.Chat.defined("Fetion.Web.Chat.Location");
Fetion.Web.Chat.Location.create = function (o)
{
    o.path = "chat/img/chat/location.png";

    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" title="' + o.desc + '" style="cursor:hand"><img src="' + o.path + '"/></div>';
    html += '<div class="pic_box_r"></div>';
    html += '</div>';
    html += '</li>';
    html += '<li class="news_tit" style="text-align:left;cursor:hand">我在这里</li>';
    html += '<li class="news_inf" title="' + o.desc + '" style="text-align:left;cursor:hand"><span>' + desc + '<span></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;
        window.external.LClick(data.type, data.name, data.desc);
    };

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

    if (o.op != false)
    {
        frm.removeFootButton();
        frm.addFootButton({
            title: "打开",
            data: o,
            onclick: function ()
            {
                var ctrl = this.ctrl;
                ctrl.img.click();
            }
        });
        frm.addFootButton({
            title: "转发",
            data: o,
            onclick: function ()
            {
                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.Location.update = function (ctrl, data)
{
    var parent = ctrl.img.parentNode;
    parent.innerHTML = "<img src='" + data.path + "' style='cursor:hand'>";
    ctrl.img = parent.childNodes[0];

    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;
    }
};