jQuery.fn.simpleContentSorting = function (a) {
    var b = {
        sortingList: ".sortingList",
        effect: "show",
        type: "sort"
    };
    var c = this;
    return this.each(function () {
        if (a) {
            jQuery.extend(b, a)
        }
        if (b.type == "sort") {
            if (jQuery.fn.selectBox) {
                c.selectBox({
                    autoWidth: false
                }).focus(function (a) {}).blur(function (a) {}).change(function f(a) {
                    jQuery(b.sortingList + " li").hide();
                    var c = jQuery(this).val();
                    jQuery(b.sortingList + " li").each(function (a) {
                        curListItem = jQuery(this);
                        temp = jQuery(this).attr("filterA");
                        temp = temp.split(",");
                        for (var d = 0, e = temp.length; d < e; ++d) {
                            if (temp[d] == c) {
                                if (b.effect == "show") {
                                    curListItem.show()
                                }
                                else if (b.effect == "fadeIn") {
                                    curListItem.fadeIn(500)
                                }
                                else {
                                    curListItem.show()
                                }
                            }
                        }
                    });
                    if (c == "all") {
                        if (b.effect == "show") {
                            jQuery(b.sortingList + " li").show()
                        }
                        else if (b.effect == "fadeIn") {
                            jQuery(b.sortingList + " li").fadeIn()
                        }
                        else {
                            jQuery(b.sortingList + " li").show()
                        }
                    }
                })
            }
            else {
                c.change(function () {
                    jQuery(b.sortingList + " li").hide();
                    var a = jQuery(this).val();
                    jQuery(b.sortingList + " li").each(function (c) {
                        curListItem = jQuery(this);
                        temp = jQuery(this).attr("filterA");
                        temp = temp.split(",");
                        for (var d = 0, e = temp.length; d < e; ++d) {
                            if (temp[d] == a) {
                                if (b.effect == "show") {
                                    curListItem.show()
                                }
                                else if (b.effect == "fadeIn") {
                                    curListItem.fadeIn(500)
                                }
                                else {
                                    curListItem.show()
                                }
                            }
                        }
                    });
                    if (a == "all") {
                        if (b.effect == "show") {
                            jQuery(b.sortingList + " li").show()
                        }
                        else if (b.effect == "fadeIn") {
                            jQuery(b.sortingList + " li").fadeIn()
                        }
                        else {
                            jQuery(b.sortingList + " li").show()
                        }
                    }
                })
            }
        }
        else {
            jQuery("body").append("<div class='hiddenresult' style='display:none;'></div>");
            jQuery(".hiddenresult").append(jQuery(b.sortingList).html());

            function d(a, c) {
                var d = jQuery(".hiddenresult li:eq(" + a + ")").clone();
                var e = jQuery(".hiddenresult li").length;
                var f = 10;
                var g = Math.min((a + 1) * f, e);
                var h = "";
                jQuery(b.sortingList).prepend("<div class='pagerContent'></div>").append("<div class='clear'></div>");
                for (var i = a * f; i < g; i++) {
                    h += "<li>" + jQuery(".hiddenresult li:eq(" + i + ")").html() + "</li>";
                    jQuery(b.sortingList + " .pagerContent").empty().append(h)
                }
                jQuery(b.sortingList + " .pagerContent li:odd").addClass("odd");
                jQuery(b.sortingList).prepend(jQuery(".resultHeader").html());
                return false
            }

            function e() {
                var a = jQuery(b.sortingList + " li").length;
                jQuery(b.sortingList).pagination(a, {
                    items_per_page: 20,
                    prev_text: "Prev",
                    next_text: "Next",
                    callback: d
                })
            }
            e()
        }
        return this
    })
}
