/*
+-----------------------------------------------------------------------------+
| $Id: jquery.bw.check.js 2009-08-18 02:20:07Z Bleakwind $
| Check ths checkbox
| Copyright (c) 2003-2010 Bleakwind (www.weaverdream.com)
| http://www.weaverdream.com/
| Release under the GNU Lesser General Public License Version 3 (LGPLv3):
|   http://www.gnu.org/licenses/lgpl.html
+-----------------------------------------------------------------------------+
*/

(function($){
    $.fn.extend({
        bwcheck:function(option){

            var find    = option.find   || ':checkbox',
                value   = option.value  || 'on';

            $(this).click( function () {
                return $(find).each(function(){
                    switch(value){
                        case 'on':
                            this.checked = true;
                            break;
                        case 'off':
                            this.checked = false;
                            break;
                        case 'toggle':
                            this.checked = !this.checked;
                            break;
                    }
                });
            });

        }
    });
})(jQuery);
