(function(n){var t={init:function(i){return i=n.extend({parentSelector:"tr"},i),this.each(function(){var u=n(this),r,e,o;if(u.data("checkboxBulkSelect_parentSelector",i.parentSelector),r=u.closest(i.parentSelector).find('input[type="checkbox"]'),r.length>0){function s(){return r.prop("checked",!0),f(),!1}function h(){return r.prop("checked",!1),f(),!1}function f(){t.update.apply(u,[r,i.parentSelector,e,o])}e=n("").addClass("selectAll").attr("href","#").text("ALL").click(s);o=n("").addClass("selectNone").attr("href","#").text("NONE").click(h);u.append(n("").text("Select: "),e,n("").text(" | "),o);r.click(f);f()}})},update:function(t,i,r,u){return this.each(function(){$this=n(this);i||(i=$this.data("checkboxBulkSelect_parentSelector"));t||(t=$this.closest(i).find('input[type="checkbox"]'));r||(r=$this.find("a.selectAll").first());u||(u=$this.find("a.selectNone").first());var f=t.filter(":checked");t.length==f.length?(r.prop("disabled",!0),u.prop("disabled",!1)):f.length==0?(u.prop("disabled",!0),r.prop("disabled",!1)):(r.prop("disabled",!1),u.prop("disabled",!1))})}};n.fn.checkboxBulkSelect=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.checkboxBulkSelect");else return t.init.apply(this,arguments)}})(jQuery);