(function(l,b){b.yit_pagination=function(a,c){this.element=b(c);this._init(a)};b.yit_pagination.defaults={pageSize:10,currentPage:1,holder:null,pagerLocation:"after",pagerStyle:"numbers"};b.yit_pagination.prototype={_init:function(a){this.options=b.extend(!0,{},b.yit_pagination.defaults,a);var c=1,d=this.options.pageSize;a=this.element;a.wrap("<div class='pagination_container'></div>");a.parents(".pagination_container").find("ul.pagination_nav").remove();a.children().each(function(a){a<c*d&&a>=(c-
    1)*d?b(this).addClass("pagination_page"+c):(b(this).addClass("pagination_page"+(c+1)),c++)});a.children().hide();a.children(".pagination_page"+this.options.currentPage).show();this.options.pageCounter=c;1<c&&this._createPagination();this._initEvents()},_initEvents:function(){var a=this.options,c=this.element;if("numbers"==this.options.pagerStyle)c.parent().on("click",".pagination_nav a",function(){var d=b(this).attr("rel");a.currentPage=d;a.holder?(b(this).parent("li").parent("ul").parent(a.holder).find("li.currentPage").removeClass("currentPage"),
    b(this).parent("li").parent("ul").parent(a.holder).find("a[rel='"+d+"']").parent("li").addClass("currentPage")):(b(this).parent("li").parent("ul").parent(".pagination_container").find("li.currentPage").removeClass("currentPage"),b(this).parent("li").parent("ul").parent(".pagination_container").find("a[rel='"+d+"']").parent("li").addClass("currentPage"));c.children().hide();c.find(".pagination_page"+d).each(function(){b(this).fadeIn(1E3)});return!1});else{var d=a.currentPage,f=a.pageCounter,e=this.element.parent().find(".pagination_nav_prev"),
    j=this.element.parent().find(".pagination_nav_next"),k=this.element.parent().find(".pagination_nav_label");c.parent().on("click",".pagination_nav a",function(){var g=b(this).parent(),h=0;if(g.hasClass("pagination_nav_prev")&&1<d)h=--d;else if(g.hasClass("pagination_nav_next")&&d<f)h=++d;else return!1;e.removeClass("pagination_nav_disabled");j.removeClass("pagination_nav_disabled");1==d&&e.addClass("pagination_nav_disabled");d==f&&j.addClass("pagination_nav_disabled");c.children().hide();c.find(".pagination_page"+
    h).each(function(){b(this).fadeIn(1E3)});g=(d-1)*a.pageSize+c.find(".pagination_page"+h).length;k.html(g+" of "+c.children().length);return!1})}},_createPagination:function(){var a="<ul class='pagination_nav'>",c=this.options.pageCounter;if("numbers"==this.options.pagerStyle)for(i=1;i<=c;i++)a=i==this.options.currentPage?a+("<li class='currentPage pagination_nav"+i+"'><a rel='"+i+"' href='#'>"+i+"</a></li>"):a+("<li class='pagination_nav"+i+"'><a rel='"+i+"' href='#'>"+i+"</a></li>");else var d=this.options.pageSize,
    f=this.element.children().length,e=this.options.currentPage,a=a+("<li class='pagination_nav pagination_nav_prev"+(1==e?" pagination_nav_disabled":"")+"'><a href='#'>&laquo;</a></li>")+("<li class='pagination_nav pagination_nav_label'>"+d*e+" of "+f+"</li>"),a=a+("<li class='pagination_nav pagination_nav_next"+(e==c?" pagination_nav_disabled":"")+"'><a href='#'>&raquo;</a></li>");a+="</ul>";if(this.options.holder)b(this.options.holder).append(a);else switch(this.options.pagerLocation){case "before":this.element.before(a);
    break;case "both":this.element.before(a);this.element.after(a);break;default:this.element.after(a)}}};b.fn.yit_pagination=function(a){if("string"===typeof a){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"yit_pagination");d?!b.isFunction(d[a])||"_"===a.charAt(0)?console.error("no such method '"+a+"' for yit_pagination instance"):d[a].apply(d,c):console.error("cannot call methods on yit_pagination prior to initialization; attempted to call method '"+a+"'")})}else this.each(function(){b.data(this,
    "yit_pagination")||b.data(this,"yit_pagination",new b.yit_pagination(a,this))});return this}})(window,jQuery);
