function PlugInit(type) {
    var idtext = "";
    var idhref = "";
    switch (type) {
        case "syslink":
            idtext = "LinkText";
            idhref = "LinkHref";
            break;
        case "sysadv":
            idtext = "AdvName";
            idhref = "AdvHref";
            break;
        default:
            break;
    }

    if (idtext != "" && idhref != "") {
        $("#MenuUrl").click(function () { BtnPlugClick(this, idtext, idhref); });
        $("#SystemUrl").click(function () { BtnPlugClick(this, idtext, idhref); });
    }
}

function BtnPlugClick(obj, idtext, idhref) {
    if ($(obj).val() == "") {
        $("#" + idhref).val("");
    } else {
        var t = $(obj).find('option:selected').text();
        t = t.replace("  ├─  ", "");
        $("#" + idtext).val(t);
        $("#" + idhref).val($(obj).val());
    }    
}