/**
  * Copyright (C) 2011 Us Media Holding B.V. All rights reserved.
  *
  * This software is the proprietary information of Us Media Holding B.V.
  * Use is subject to license terms.
  */
/*
(function($){
    $(document).ready(function(){
        // On select all click, refresh the result count + check all the attached checkboxes
        $("#searchform .main_tag_field .header input[type='checkbox']").click(function(e){
            var isChecked = $(this).is(":checked");
            var fieldsets = $(this).parents("fieldset");

            if (fieldsets.length > 0) {
                var fieldset        = fieldsets[0];
                var checkBoxes      = $("li input[type='checkbox']", fieldset);
                var uniformBoxes    = $("li span, li label", fieldset);

                checkBoxes.attr("checked", isChecked);

                if (isChecked) {
                    uniformBoxes.addClass('checked');
                }
                else {
                    uniformBoxes.removeClass('checked');
                }

                refreshCount();
            }
        });

        // On single item click, refresh the result count
        $("#searchform .main_tag_field li input[type='checkbox']").click(function(e){
            refreshCount();
        });
    });
})(jQuery);



jQuery( function($) {
    // Ordering on the search page silently updates the hidden form and submits it
    jQuery("#ordering").change(function() {
        var ordering = jQuery("#ordering").val();
        jQuery('#hidden-info input[name="ordering"]').val(ordering);
        jQuery("#hidden-info").submit();
    });


    // Check 'toggle-all' for tags
    jQuery('#tag_fields .toggle-all input').each( function() {
        var mainTagId = jQuery(this).val();

        var allChecked = true;
        var checkBoxes = jQuery("#tags_"+mainTagId+" li input");
        checkBoxes.each(function() {
            if (!this.checked) {
                allChecked = false;
            }
        });

        if (allChecked && checkBoxes.length > 0) {
            jQuery(this).attr('checked', true);
            jQuery(this).parent('span').addClass('checked');
        }
    });
});


function refreshCount() {
    var query   = getQueryString();
    var tags    = getSelectedTags();

    jQuery.ajax({
        url: "zoeken/search-count.do",
        method: "get",
        dataType: "json",
        cache: false,
        data: {
            queryString: query,
            selectedTags: tags
        },
        success: function(data){
            updateCount(data.total);
        }
    });
}

function updateCount(value) {
    jQuery("#total").empty().append(value);
}*/
