Check-box lists dynamic response

Check-box lists dynamic response

Hi,
I have a list element with a lot of sub categories. That will be used for category management.
HTML example
  1. <ul>
  2.       <li><input type="checkbox" /> Category name 1
  3.             <ul>
  4.                   <li><input type="checkbox" /> Subategory name 2</li>
  5.             </ul>
  6.       </li>
  7.       <li><input type="checkbox" /> Category name 2
  8.             <ul>
  9.                   <li><input type="checkbox" /> Subategory name 3</li>
  10.                   <li><input type="checkbox" /> Subategory name 4
  11.                         <ul>
  12.                               <li><input type="checkbox" /> Subsubategory name 1</li>
  13.                         </ul>
  14.                   </li>
  15.             </ul>
  16.       </li>
  17. </ul>
I am just looking for a plug-in or script which would suit my needs the most and they are:
  1. To claps all the tree up to main categories
  2. One time if a parents check-box is checked, that all child`s check-box would be checked.
  3. Another time then parent is checked the child`s check-boxes would stay as it is but if child is checked all the direct parents of it would be checked to.
Is there some kind plug-in which would do that?