/// <reference path="jquery-1.10.2.min.js" />
$(function () {
    $("#Lunbtn").click(function () {
        var LunName = $.trim($("#Lun_Name").val());
        var img = $.trim($("#img").attr("src"));
        var LunLink = $.trim($("#Lun_Link").val());
        if (LunName == "") {
            alert("轮播名称不能为空");
            return;

        }
        if (img == "") {
            alert("轮播图片不能为空");
            return;
        }
        if (LunLink == "") {
            alert("轮播链接不能为空");
            return;
        } else {
            $.post("/ajax/Admin_Other.ashx", { "type": "LunBo", "LunName": LunName, "img": img, "LunLink": LunLink }, function (data) {
                var data = eval('(' + data + ')');
                if (data.Success == true) {
                    alert("添加成功");
                    window.location.href = "./Admin_RotationList.aspx";
                } else {
                    alert("添加失败");
                }
            })


        }

    })


})


$(function () {
    $("#Lun_Edit_btn").click(function () {
        var LunEditName = $.trim($("#Lun_Edit_Name").val());
        var lunboid = $.trim($("#lunboid").val());
        var img = $.trim($("#img").attr("src"));
        var LunEditLink = $.trim($("#Lun_Edit_Link").val());
        if (LunEditName == "") {
            alert("轮播名称不能为空");
            return;
        }
        if (img == "") {
            alert("轮播图片不能为空");
            return;
        }
        if (LunEditLink == "") {
            alert("轮播链接不能为空");
            return;
        } else {
            $.post("/ajax/Admin_Other.ashx", { "type": "LunBoedit", "LunEditName": LunEditName, "img": img, "LunEditLink": LunEditLink, "lunboid": lunboid }, function (data) {
                var data = eval('(' + data + ')');
                if (data.Success == true) {
                    alert("修改成功");
                    window.location.href = "./Admin_RotationList.aspx";
                } else {
                    alert("修改失败")
                }

            })

        }
    })

})

function bodel(id) {
    if (!confirm("确定要删除吗？") == true) {
        return true;
    } else {
        $.post("/ajax/Admin_Other.ashx", { "type": "bodel", "id": id }, function (data) {
            if (data == "ok") {
                alert("删除成功");
                window.location.href = "./Admin_RotationList.aspx";
            } else {
                alert("删除失败")
            }


        })

    }


}