//保存数据
function saveData() {
    //同步保存数据
    var strRecord = "{\"Records\":[";
    strRecord += "{ \"a1\":\"0\",\"a2\":\"number\",\"a3\":\"" + $("#div_number").combobox("getValue") + "\"},";
    strRecord += "{\"a1\":\"0\",\"a2\":\"money\",\"a3\":\"" + $("#div_money").combobox("getValue") + "\"},";
    strRecord += "{\"a1\":\"0\",\"a2\":\"percent\",\"a3\":\"" + $("#div_percent").combobox("getValue") + "\"},";
    //    strRecord += "{\"a1\":\"0\",\"a2\":\"isshowtip\",\"a3\":\"" + $("#showTip")[0].checked + "\"},";
    strRecord += "{\"a1\":\"0\",\"a2\":\"pagecount\",\"a3\":\"" + $("#pageCount").val() + "\"}]}";
    var indexs = ParseData(window.external.DoOptions("TXtsz", "Edit", strRecord));

    if (indexs.ReturnCode == 0) {
        window.parent.strPricePlace = $("#div_money").combobox("getValue");
        window.parent.strCountPlace = $("#div_number").combobox("getValue");
        window.parent.strMoneyPlace = $("#div_money").combobox("getValue");
        window.parent.iRowsPerPage = $("#pageCount").val();
        window.parent.strPercentPlace = $("#div_percent").combobox("getValue");
        //        window.parent.bShowMsgOfMoney = $("#showTip")[0].checked;
        window.parent.cihoAlert("保存成功！", msgBox.dlgBtn.Ok);
        return false;
    } else {
        window.parent.cihoAlert(indexs.MSG, msgBox.dlgBtn.Ok);
        return false;
    }
}

function setData() {
    var results = ParseData(window.external.DoOptions("TXtsz", "GetList", "{}"));
    if (results.ReturnCode == 0) {
        for (var i = 0; i < results.Records.length; i++) {
            switch (results.Records[i].a2) {
                case "number":
                    $("#div_number").combobox("setValue", results.Records[i].a3);
                    break;
                case "money":
                    $("#div_money").combobox("setValue", results.Records[i].a3);
                    break;
                case "percent":
                    $("#div_percent").combobox("setValue", results.Records[i].a3);
                    break;
                case "isshowtip":
                    if (results.Records[i].a3 == "true") {
                        $("#showTip").attr("checked", true);
                    } else {
                        $("#showTip").attr("checked", false);
                    }
                    break;
                case "pagecount":
                    $("#pageCount").val(results.Records[i].a3)
                    break;
            }
        }
    }
}

function reset() {
    var results = ParseData(window.external.DoOptions("TXtsz", "DoOthers", '{"option":"2"}'));
    if (results.ReturnCode == 0) {
        for (var i = 0; i < results.Records.length; i++) {
            switch (results.Records[i].a2) {
                case "number":
                    $("#div_number").combobox("setValue", results.Records[i].a3);
                    window.parent.strCountPlace = results.Records[i].a3;
                    break;
                case "money":
                    $("#div_money").combobox("setValue", results.Records[i].a3);
                    window.parent.strPricePlace = results.Records[i].a3;
                    window.parent.strMoneyPlace = results.Records[i].a3;
                    break;
                case "percent":
                    $("#div_percent").combobox("setValue", results.Records[i].a3);
                    break;
                case "isshowtip":
                    if (results.Records[i].a3 == "true") {
                        $("#showTip").attr("checked", true);
                    } else {
                        $("#showTip").attr("checked", false);
                    }
                    break;
                case "pagecount":
                    $("#pageCount").val(results.Records[i].a3);
                    //window.parent.iRowsPerPage = results.Records[i].a3;
                    break;
            }
        }
    }
    //     else {
    //        window.parent.cihoAlert(results.MSG, msgBox.dlgBtn.Ok);
    //    }
}
