Checkbox and accordion

Checkbox and accordion

Checkbox and accordion (without the accordion plugin because of checkbox).

Hello,
Could you please help me making this accordion like code more powerfull and or building a plugin ?

Html :
  <div id="div6"><!-- div1, 2, 3 ... -->
    <input name="check6" type="checkbox" />
    <span>Title</span> <br />
    <label for="txt6">Comment :
    <textarea name="txt6" class="expanding"></textarea>
    </label>
  </div>


Jquery :

   $(document).ready (function() {
      $('div label').hide();
   
   // #div1 , #div2, #div3 ... //
      $('#div6 input[@type="checkbox"]').click(function() {   
            if($(this).attr("checked")) {
            $('div label').slideUp('slow');
            $('#div6 label').slideDown('slow');
            } else {
               $('div label').slideUp('slow');
               $('#div6 :input[@type="textarea"]').val("");
            }
       });
      $('#div6 span').click(function() {
          $('div label').slideUp('slow');
          $('#div6 label').slideDown('slow');
      });
       $('#div6 input[@type="file"]').click(function() {   //FOCUS FILE UPLOAD
         $("#div6 input[@type='checkbox']").attr("checked", "checked");
      });
   


// #div1 , #div2, #div3 //
// ... //

// SAME WITH VAR i : //

$("div").each(function(i){
         $('#div' + i + ' input[@type="checkbox"]').click(function() {
            if($(this).attr("checked")) {
            $('div label').slideUp('slow');
            $('#div' + i + ' label').slideDown('slow');
            } else {
               $('div label').slideUp('slow');
               $('#div' + i + ' :input[@type="textarea"]').val("");
            }
       });
      $('#div' + i + ' span').click(function() {
          $('div label').slideUp('slow');
          $('#div' + i + ' label').slideDown('slow');
      });
       $('#div' + i + ' textarea').focus(function() {   //Checked on focus textarea
         $('#div' + i + ' :input[@type="checkbox"]').attr('checked', 'checked');
      });   
       $('#div' + i + ' input[@type="file"]').click(function() {   //Checked on focus file upload
         $("#div" + i + " input[@type='checkbox']").attr("checked", "checked");
      });         
});
   

  return false;
  });



Thanks.
Alain.