$(function(){
 
    $("#d2all").click(function () {
          $('.d2group').attr('checked', this.checked);
    });
 
    $(".d2group").click(function(){
 
        if($(".d2group").length == $(".d2group:checked").length) {
            $("#d2all").attr("checked", "checked");
        } else {
            $("#d2all").removeAttr("checked");
        }
 
    });

    $("#sterifaball").click(function () {
          $('.fabgroup').attr('checked', this.checked);
    });
 
    $(".fabgroup").click(function(){
 
        if($(".fabgroup").length == $(".fabgroup:checked").length) {
            $("#sterifaball").attr("checked", "checked");
        } else {
            $("#sterifaball").removeAttr("checked");
        }
 
    });

    $("#steriplexHCall").click(function () {
          $('.hcgroup').attr('checked', this.checked);
    });
 
    $(".hcgroup").click(function(){
 
        if($(".hcgroup").length == $(".hcgroup:checked").length) {
            $("#steriplexHCall").attr("checked", "checked");
        } else {
            $("#steriplexHCall").removeAttr("checked");
        }
 
    });

    $("#steriplexUltraall").click(function () {
          $('.ultragroup').attr('checked', this.checked);
    });
 
    $(".ultragroup").click(function(){
 
        if($(".ultragroup").length == $(".ultragroup:checked").length) {
            $("#steriplexUltraall").attr("checked", "checked");
        } else {
            $("#steriplexUltraall").removeAttr("checked");
        }
 
    });

    $("#biosprayall").click(function () {
          $('.biogroup').attr('checked', this.checked);
    });
 
    $(".biogroup").click(function(){
 
        if($(".biogroup").length == $(".biogroup:checked").length) {
            $("#biosprayall").attr("checked", "checked");
        } else {
            $("#biosprayall").removeAttr("checked");
        }
 
    });

});
