﻿$().ready(function() {
    $("#SearchControl1_txtSearch").click(function() {
        if ($(this).val() == '我来找乐子...') {
            $(this).val('');
        }
    })

    $("#rdrd").children().each(function(e) {
        var rid = $(".newtext:eq(" + e + ")").attr("id").substring(1);
        $.ajax({
            type: "POST",
            url: "./ajax/reply2.ashx",
            data: "rid=" + rid,
            success: function(result) {
                if (result != "") {
                    $("#_" + rid + " .bottom").before(result);
                }
            },
            error: function() {}
        });
    })

    $("#new a[rel=pb]").click(function() {
        if (confirm("确定屏蔽该消息?")) {
            var _this = this;
            var id = $(_this).parents(".newtext").attr("id").substring(1);
            $.ajax({
                type: "POST",
                url: "./ajax/Twitter.ashx",
                data: "id=" + id + "&type=update",
                success: function(result) {
                    if (result > 0) {
                        $(_this).parents(".newtext").slideUp("fast");
                    } else {
                        alert("屏蔽失败。");
                    }
                },
                error: function() { alert("屏蔽据错误。"); }
            });
        }
    })

    $("#hot a[rel=pb]").click(function() {
        if (confirm("确定屏蔽该消息?")) {
            var _this = this;
            var id = $(_this).parents(".newtext").attr("id").substring(1);
            $.ajax({
                type: "POST",
                url: "./ajax/Twitter.ashx",
                data: "id=" + id + "&type=update",
                success: function(result) {
                    if (result > 0) {
                        $(_this).parents(".newtext").slideUp("fast");
                    } else {
                        alert("屏蔽失败。");
                    }
                },
                error: function() { alert("屏蔽据错误。"); }
            });
        }
    })
});
