help with checkboxes

help with checkboxes

I have the following code..I'm trying to uncheck all check boxes except the ones that are already checked in the current pane. code I have so far is not working for me..it's not allowing any checking once I put this part
 

// Uncheck all check boxes but in this pane...Prevent multiple product download

$(

'.accordion :checkbox' ).not(pane).attr( 'checked' , false );

 

$(

'.accordion :checkbox' ).click( function () {

var pane = $( this ).closest( 'div' );

// Uncheck all check boxes but in this pane...Prevent multiple product download

$(

'.accordion :checkbox' ).not(pane).attr( 'checked' , false );

pane.find(

'.bt' ).attr( 'disabled' , !pane.find( ':checkbox' ).is( ':checked' )); // only if it finds a checkbox checked do enable button

if (!$( this ).is( ':checked' )) {

$(

'.accordion .chkall' ).attr( 'checked' , false ) // unchecks select all if user clicks select all and then changes mind by unchecking a file

}

// if user manually checks all the checkboxes it checks the select all checkbox..

var collection = $( this ).closest( 'div' ).find( ':checkbox' ).not( '.chkall' ).not( ':disabled' )

var count = 0

$.each($(collection),

function (k, v) {

if ($(v).is( ':checked' )) { count += 1 }

if (count == collection.length) { $( this ).closest( 'div' ).find( ':checkbox' ).not( ':disabled' ).attr( 'checked' , true ); }

});

});