astChecked = this;
                    }
                }
            });

            // Handle click on checkbox to set state of "Select all" control
            $('#wanted_table tbody').on('change', 'input[type="checkbox"]', function(){
                count_checks();

                // If checkbox is not checked
                if(!this.checked){
                    var el = $('#wanted_table-select-all').get(0);
                    // If "Select all" control is checked and has 'indeterminate' property