jQuery.fn.checkbox = function(opt){
   jQuery(":checkbox", this).bind('change', function() {
            opt.id  = opt.id || $(this).attr('id');
            check = $(this).attr('checked') == true;
            if(check){
                avalue = '1';
            }else{
                avalue = '0';
            }

            var self = jQuery(this);
            thinkId = opt.id + '_think';
            var mimg = '<img id="'+ thinkId +'" src="'+ opt.indicator +'" border="0">';
            $(this).hide();
            $(this).after(mimg);
            $.post(opt.ajaxURL, { id: opt.id, value: avalue }, function(data){
                $(self).next().remove();
                $(self).show();
                if(data.okay == undefined | !data.okay){
                    alert("Error: " + data.error);
                    if(data.value == 0){
                        check = false;
                    }else{
                        check = true;
                    }
                    $(self).attr('checked', check);
                }
              }, 'json');
       });
};
