/*! jQuery.checkallbox - v1.2.0 - 2013-02-08 * http://liveline.github.com/jquery-checkallbox/ * Copyright (c) 2013 James Bebbington; Licensed MIT */ (function(e){function n(n,r){this._name=t,this.checkallbox=e(n),this.options=e.extend({},e.fn[t].options,r),this.init()}var t="checkallbox";n.prototype={init:function(){this.scope=this.checkallbox.parents(this.options.scope),this.scope.on("change.checkallbox",":checkbox",e.proxy(function(t){e(t.target).is(this.checkallbox)?this._updateCheckboxes():this._updateCheckallbox()},this)),this._updateCheckallbox()},_findCheckboxes:function(){return this.scope.find(":checkbox").not(this.checkallbox).filter(":enabled")},_updateCheckallbox:function(){var e=this._findCheckboxes();this.checkallbox.prop("checked",e.length>0&&e.not(":checked").length===0),this.checkallbox.prop("disabled",e.length===0),this.checkallbox.prop("indeterminate",e.filter(":checked").length>0&&e.not(":checked").length>0)},_updateCheckboxes:function(){var e=this._findCheckboxes();e.prop("checked",this.checkallbox.prop("checked"))}},n.prototype.update=n.prototype._updateCheckallbox,e.fn[t]=function(r){var i=arguments,s=r===undefined||typeof r=="object"?"init":r;return s==="init"?this.each(function(){e.data(this,"plugin_"+t)||e.data(this,"plugin_"+t,new n(this,r))}):this.each(function(){var o=e.data(this,"plugin_"+t);s[0]!=="_"&&o instanceof n&&typeof o[r]=="function"?o[r].apply(o,Array.prototype.slice.call(i,1)):e.error("Method '"+r+"' does not exist on "+t)})},e.fn.checkallbox.options={scope:"form"}})(jQuery);