Think outside the box..

Think outside the box..

I am making a function that works with a set of checkboxes. The checkboxes are a list of files, and my be required by some of the others in the list.

I have functions set up to disable the required checkboxes when certain boxes are marked, but im stumped atm on how to make the boxes stay diabled until ALL of the boxes requireing them are unchecked

(eg. i 2 boxes require the same file, it is marked and disabled in teh list, if I uncheck on of the 2 boxes requiring that file, it is ernabled and unmarked)

var dialogReq = new Array('dimensions', 'mouse', 'draggable', 'resizable');
var draggableReq = new Array('dimensions', 'mouse');
function requireMe(id){
   //console.log('requireMe ID: '+ id);
   switch (id){
      case 'edit-dialog':
         jQuery.each(dialogReq,
            function(){
               $('#edit-' + this).attr('checked', true).attr('disabled', 'disabled').parent().parent().append('<div class="status-req">This file is required by one of your selections. It has been automatically enabled.</div>');
            }
         );
         break;
      case 'edit-draggable':
         jQuery.each(draggableReq,
            function(){
               $('#edit-' + this).attr('checked', true).attr('disabled', 'disabled').parent().parent().append('<div class="status-req">This file is required by one of your selections. It has been automatically enabled.</div>');
            }
         );
         break;
   }
}

function unrequireMe(id){
   switch (id){
      case 'edit-dialog':
         jQuery.each(dialogReq,
            function(){
               $('#edit-' + this).removeAttr('disabled').attr('checked', false).parent().siblings('.status-req').remove();
            }
         );
         break;
      case 'edit-draggable':
         jQuery.each(draggableReq,
            function(){
               $('#edit-' + this).removeAttr('disabled').attr('checked', false).parent().siblings('.status-req').remove();
            }
         );
         break;
   }
}


This isnt production code yet, so please don't pay much attention ot teh sloppyness and redunancy.