Help editing a radio button plugin

Help editing a radio button plugin

I'm using this nice, simple plugin:  http://www.jqueryscript.net/form/Easy-Custom-Checkbox-And-Radio-Input-Plugin-With-jQuery-ezMark.html - it works great, but sometimes a radio button or checkbox will be greyed out if you select certain other buttons or boxes due to a conflict management system. 

Right now, when a button or box gets greyed out it has the same image as an unselected button or box. Is there a way to make it so a greyed out button or box has its own image? And also, sometimes a button or box will be automatically selected and then greyed out, so is it possible to have an image for that as well?

So, in summary, I would like it so a greyed out and unselected radio button or checkbox has its own image and a selected and greyed out radio button or checkout has its own image.

Thanks.

Here is the js code:

  1. (function($) {
  2.     $.fn.ezMark = function(options) {
  3.         options = options || {};
  4.         var defaultOpt = {
  5.             checkboxCls: options.checkboxCls || 'ez-checkbox',
  6.             radioCls: options.radioCls || 'ez-radio',
  7.             checkedCls: options.checkedCls || 'ez-checked',
  8.             selectedCls: options.selectedCls || 'ez-selected',
  9.             hideCls: 'ez-hide'
  10.         };
  11.         return this.each(function() {
  12.             var $this = $(this);
  13.             var wrapTag = $this.attr('type') == 'checkbox' ?
  14.                 '<div class="' + defaultOpt.checkboxCls + '">' :
  15.                 '<div class="' + defaultOpt.radioCls + '">';
  16.             if ($this.attr('type') == 'checkbox') {
  17.                 $this.addClass(defaultOpt.hideCls).wrap(wrapTag)
  18.                     .change(function() {
  19.                         if ($(this).is(':checked')) {
  20.                             $(this).parent().addClass(
  21.                                 defaultOpt.checkedCls);
  22.                         } else {
  23.                             $(this).parent().removeClass(
  24.                                 defaultOpt.checkedCls);
  25.                         }
  26.                     });
  27.                 if ($this.is(':checked')) {
  28.                     $this.parent().addClass(defaultOpt.checkedCls);
  29.                 }
  30.             } else if ($this.attr('type') == 'radio') {
  31.                 $this.addClass(defaultOpt.hideCls).wrap(wrapTag)
  32.                     .change(function() {
  33.                         $('input[name="' + $(this).attr(
  34.                             'name') + '"]').each(
  35.                             function() {
  36.                                 if ($(this).is(
  37.                                     ':checked')) {
  38.                                     $(this).parent().addClass(
  39.                                         defaultOpt.selectedCls
  40.                                     );
  41.                                 } else {
  42.                                     $(this).parent().removeClass(
  43.                                         defaultOpt.selectedCls
  44.                                     );
  45.                                 }
  46.                             });
  47.                     });
  48.                 if ($this.is(':checked')) {
  49.                     $this.parent().addClass(defaultOpt.selectedCls);
  50.                 }
  51.             }
  52.         });
  53.     }
  54. })(jQuery);