(function ($) {
    old_function = $.fn.smartsearch.searchlets.checkbox_options.prototype.init;
    $.fn.smartsearch.searchlets.checkbox_options.prototype.init = function () {
        old_function.call(this);
        searchlet=this.searchlet;
        this.searchlet.find("input").bind('click', function() {
            ct_div = $('div.convention_company_type_div');
            ct_searchlet = $('div#convention_company_type-searchlet');
            if (searchlet.find("input[value='conventioncompany']").get(0).checked) {
                ct_div.show();
            } else {
                ct_div.find('option[selected]').each(function() {
                    $(this).attr('selected','');
                    $(this).parent('select').triggerHandler('change');
                });
                ct_div.hide();
            }
        });
	this.searchlet.find("input[value='conventioncompany']").triggerHandler('click');
    };

    $(document).ready(function () {
        $("a.searchFormClosed").click(function() {
            if($("#convention_company_type__in").find("option[selected:selected]").length > 0 || $("#id_class_name_conventioncompany").attr("checked")){
                $("#convention_company_type__in").parent().parent().parent().removeClass("hide");
            }
        });
    });

})(jQuery);


