$(function() {
    var f = $(".pages_info"),
        a = $(".pages_info option"),
        d = [],
        m = null;
    if (!$("div").hasClass("pages_info")) return !1;
    f.html("<div class='pages_none'>" + f.html());
    d = $(".pages_none");
    var g = $(".pages_none select");
    d.hide();
    d = d.html().split("&nbsp;");
    $.each(d, function(b, c) {
        -1 != c.indexOf("总数") && (m = c)
    });
    f.append('<div class="pages_box">');
    var h = $(".pages_box"),
        n = null,
        e = 0,
        p = "";
    a.each(function(b) {
        n = $(this).attr("value");
        e = b + 1;
        0 == e && (e = 1);
        p = $(this).is(":checked") ? "page_curr" : "";
        h.append('<a class="' + p + '" href="' + n + '">' + e)
    });
    var b = $(".pages_box a"),
        q = a.first().val(),
        r = a.last().val(),
        k = !1,
        l = !1;
    0 == g.html().length && (k = !0);
    0 == g.html().length && (l = !0);
    b.each(function() {
        var bLen1 = b.length-1;
        $(this).hide();
        q = $(".page_curr").prev().attr("href");
        r = $(".page_curr").next().attr("href");
        var a = $(".page_curr").index() - 2,
            c = $(".page_curr").index() + 2;
        0 <= a && c <= bLen1 ? $(this).index() >= a && $(this).index() <= c && $(this).show() : 0 > a ? 0 <= $(this).index() && 4 >= $(this).index() && $(this).show() : c > bLen1 && 0 <= $(this).index() && $(this).index() <= bLen1 && $(this).index() >= bLen1 - 4 && $(this).show();
        0 == $(".page_curr").index() && (k = !0);
        $(".page_curr").index() == bLen1 && (l = !0)
    });
    h.prepend('<span class="page_total">' + m + '</span><a class="page_first" href = "' + a.first().val() + '">首页<a class="page_pre" href = "' + q + '">上一页');
    h.append('<a class="page_next" href = "' + r + '">下一页<a class="page_last" href = "' + a.last().val() + '">尾页</a><b class="page_jump">转到 ');
    $(".page_jump").append(g);
    k && ($(".page_pre").removeAttr("href"), $(".page_first").removeAttr("href"));
    l && ($(".page_next").removeAttr("href"), $(".page_last").removeAttr("href"))
});