function __copy(id) {
    var Url2 = document.getElementById(id);
    Url2.select(); // 选择对象
    document.execCommand("Copy"); // 执行浏览器复制命令
}
function _copy(id) {
    var _obj = document.getElementById(id);
    _obj.select(); // 选择对象
    var txt = $("#" + id).val();
    if (window.clipboardData) {
        window.clipboardData.clearData();
        clipboardData.setData("Text", txt);
        //alert("复制成功！");

    } else if (navigator.userAgent.indexOf("Opera") != -1) {
        window.location = txt;
    } else if (window.netscape) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        } catch (e) {
            //alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip)
            return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans)
            return;
        trans.addDataFlavor("text/unicode");
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = txt;
        str.data = copytext;
        trans.setTransferData("text/unicode", str, copytext.length * 2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip)
            return false;
        clip.setData(trans, null, clipid.kGlobalClipboard);
        //alert("复制成功！");
    }
}

$(function () {
    $('<div style="position: absolute; z-index:100; display:block; background:url(/ligerUI/hot-boxbg.png) no-repeat; width:322px; color:White; font-size:14px;font-weight:bold;  display:none; height:55px;text-align:center; font-family:微软雅黑,黑体; line-height:50px;" id="DivMain" ></div> ').appendTo($("body"));
});

function _alert(html) {
    var top = document.documentElement.scrollTop + document.body.scrollTop + (document.documentElement.clientHeight - $("#DivMain").height() - 200) / 2 + "px";
    $("#DivMain").css("top", top);
    $("#DivMain").css("left", document.documentElement.scrollLeft + (document.documentElement.clientWidth - $("#DivMain").width()) / 2 + "px");
    $("#DivMain").html(html);

    $("#DivMain").fadeIn(1000, function () {
        $("#DivMain").fadeOut(3000);
    });
}


function _alertH(html) {
    var top = document.documentElement.scrollTop + (document.documentElement.clientHeight - $("#DivMain").height() - 200) / 2 + "px";
    $("#DivMain").css("top", top);
    $("#DivMain").css("left", document.documentElement.scrollLeft + (document.documentElement.clientWidth - $("#DivMain").width()) / 2 + "px");
    $("#DivMain").html(html);

    $("#DivMain").fadeIn(1000, function () {
        $("#DivMain").fadeOut(1500, function () {

        });

    });
}



function isEmail(strEmail) {
    if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function isUrl(url) {
    var reg = /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
    return reg.test(url);
}

function isMobile(value) {
    var reg = /^0?(13[0-9]|15[012356789]|18[0236789]|14[57])[0-9]{8}$/g;
    return reg.test(value);
}


function getQuery(url, name) {
    if (!isUrl(url)) {
        return null;
    }
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var n = url.indexOf('?');
    if (n < 0) {
        return null;
    }
    var r = url.substring(n + 1).match(reg);
    if (r != null)
        return unescape(r[2]);
    return null;
}

$(document).ready(function () {
    $('#replyType').change(function () {
        var p1 = $(this).children('option:selected').val();
        if (p1 == "LINK") {
            $(".libFrom").find("a").hide();
            $(".libFrom").find("input").show();
        } else {
            $(".libFrom").find("input").hide();
            $(".libFrom").find("a").show();
         }
        if (p1 == "TEXT" ||
                p1 == "SINGNEWS" ||
                p1 == "MULITENEWS" ||
                p1 == "MUSIC" ||
                p1 == "PHOTHO" ||
                p1 == "LBS") {
            $('input[name=OpFrom]').attr('value', '0');
        }
        else {
            $('input[name=OpFrom]').attr('value', '1');
        }
    });
    $(".replyType").change();
}) 

function _Tdlgcall(op) {
    //
}


function showWatting() {
    //ymPrompt.win("<div class='watting'>正在上传中,请稍后...</div>",166 , 80, "素材上传", _Tdlgcall);
}

function hideWatting() {
    //window.parent.ymPrompt.doHandler('ok', true);
}