Sry, here is my answer:
Here is first the output for listing the category in checkbox:
Walker for the Category Output
class Adv_Multicheck_Walker_Category extends Walker {
var $tree_type="category";
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
function start_lvl($output, $depth, $args) {
if ( 'list' != $args['style'] )
return $output;
$indent = str_repeat("\t", $depth);
$output .= "$indent<ul class="children">\n";
return $output;
}
function end_lvl($output, $depth, $args) {
if ( 'list' != $args['style'] )
return $output;
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n";
return $output;
}
function start_el($output, $category, $depth, $args) {
extract($args);
$cat_name = esc_attr($category->name);
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
$checked = '';
if ( empty($_GET['s']) || $_GET["adv_cat_{$category->term_id}"] == 'on' )
$checked = 'checked="checked"';
$output .= "<li><input type="checkbox" class="cb-element" checked='checked' name="adv_cat_{$category->term_id}" id='adv_cat_{$category->term_id}' /> ";
$output .= "<label for="adv_cat_{$category->term_id}"><span></span>$category->name</label>";
if ( isset($show_count) && $show_count )
$output .= ' (' . intval($category->count) . ')';
if ( isset($show_date) && $show_date )
$output .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
}
function end_el($output, $page, $depth, $args) {
if ( 'list' != $args['style'] )
return $output;
$output .= "</li>\n";
return $output;
}
}
function adv_cats($args="") {
$defaults = array(
'show_option_all' => '?',
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'style' => 'list',
'show_count' => 1,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_image' => '',
'exclude' => '',
'hierarchical' => true,
'title_li' => '',
'echo' => 0
);
$r = wp_parse_args( $args, $defaults );
if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
$r['pad_counts'] = true;
}
if ( isset( $r['show_date'] ) ) {
$r['include_last_update_time'] = $r['show_date'];
}
extract( $r );
$categories = get_categories($r);
$output="";
if ( $title_li && 'list' == $style )
$output="<li class="categories">" . $r['title_li'] . '<ul>';
if ( empty($categories) ) {
if ( 'list' == $style )
$output .= '<li>' . __("No categories", "WPL") . '</li>';
else
$output .= __("No categories", "WPL");
} else {
global $wp_query;
if( !empty($show_option_all) )
if ('list' == $style )
$output .= "<li><input type="checkbox" class="checkall" checked='checked' name="checkall" id='checkall' /> ";
$output .= "<label for="checkall"><span></span>".__('Check/Uncheck All', 'WPL').'</label>';
if ( is_category() )
$r['current_category'] = $wp_query->get_queried_object_id();
if ( $hierarchical )
$depth = 0; // Walk the full depth.
else
$depth = -1; // Flat.
$output .= $this->walk_category_tree($categories, $depth, $r);
}
if ( $title_li && 'list' == $style )
$output .= '</ul></li>';
$output = apply_filters('wp_list_categories', $output);
return '<ul>' . $output . '</ul>';
}
function walk_category_tree() {
$walker = new Adv_Multicheck_Walker_Category;
$args = func_get_args();
return call_user_func_array(array(&$walker, 'walk'), $args);
}
Then download this http://code.google.com/p/checkboxtree/
Then init this plugin by the div where one create the output in checkbox, like:
$('#adv_search_form .multicheck-cats').tree({ components: ['checkbox', 'collapse'], onCheck: { node: 'expand', ancestors: 'checkIfFull', descendants: 'check' }, onUncheck: { node: 'collapse', ancestors: 'uncheck' } });
And here is a live Preview: