$(function () {
    //删除链接
    $("a[rel='del']").click(function () {
        var $delObject = $(this);
        if (confirm("确定要删除 [ " + $delObject.attr("title") + " ] 链接吗？")) {
            $.ajax({
                type: "POST",
                url: "Ajax/Slide.ashx",
                data: { 'com': 'delslide', 'sid': $delObject.attr("href"), 'picfile': $delObject.attr("rev"), 'title': $delObject.attr("title") },
                datatype: "json",
                beforeSend: function (data, textStatus) {
                    showMsg("[ " + $delObject.attr("title") + " ] 正在删除中 ", true);
                },
                success: function (data, textStatus) {
                    if (data == "1") {
                        $delObject.parent().parent("tr").remove();
                    } else {
                        alert("删除失败!");
                    }
                    showMsg("", false);
                },
                error: function (e) { alert("连接失败,请向Eoyoo官方技术人员反馈!"); }
            })
        }
        return false;
    });
    //移动链接位置
    $("a[rel='shift']").click(function () {
        //当前对象
        var $nowObject = $(this);
        $.ajax({
            type: "POST",
            url: "Ajax/Slide.ashx",
            data: { 'com': $nowObject.attr("href"), 'naviid': $nowObject.attr("naviid"), 'objectid': $nowObject.attr("name"), 'orderid': $nowObject.attr("rev") },
            datatype: "json",
            beforeSend: function (data, textStatus) {
                showMsg("移动中 ", true);
            },
            success: function (data, textStatus) {
                switch (data) {
                    case "0":
                        alert("更新失败");
                        break;
                    case "1":
                        location.reload();
                        break;
                    case "2":
                        if ($nowObject.attr("href") == "upward") {
                            alert("已经是最上了!");
                        } else {
                            alert("已经是最下了!");
                        }
                        break;
                }
                showMsg("", false);
            },
            error: function (e) { alert("连接失败,请向Eoyoo官方技术人员反馈!"); }
        })
        return false;
    });
})