var opt_in_id="1",opt_out_id="2",original_all_asme_value="",afterDisableCategories=function(){},disableCategories,resetIndeterminate;$(function(){$('button[type="reset"]').click(function(n){n.preventDefault();$("#CategoryConsentForm")[0].reset();disableCategories(original_all_asme_value);resetIndeterminate()});$("#select-all-button").click(function(){$("#ASMEPreferenceCategories input:checkbox").prop("checked",!0);$("#ASMEPreferenceCategories input:checkbox").removeAttr("indeterminate")});$("#clear-all-button").click(function(){$("#ASMEPreferenceCategories input:checkbox").prop("checked",!1);$("#ASMEPreferenceCategories input:checkbox").removeAttr("indeterminate")});$('#ASMEPreferenceCategories input[type="checkbox"]').change(function(){function r(t){var i=$('input:checkbox[data-category-id="'+t+'"]'),e=$('ul[data-category-id="'+t+'"] input:checkbox'),u=!0,f=i.data("parent");e.each(function(){return u=$(this).prop("checked")===n});u?(i.removeAttr("indeterminate"),i.prop("checked",n)):(i.attr("indeterminate",!0),i.prop("checked",!1));f&&r(f)}var n=$(this).prop("checked"),u=$(this).data("category-id"),i=$(this).data("parent"),t;$(this).removeAttr("indeterminate");t=$('ul[data-category-id="'+u+'"]');n&&(t.hasClass("collapse")?t.collapse("show"):$(this).data("panel-id")&&$("#"+$(this).data("panel-id")).collapse("show"));t.find("input:checkbox").prop({checked:n}).removeAttr("indeterminate");i&&r(i)});$("input:radio:checked").data("chk",!0);$("input:radio").click(function(){$("input[name='"+$(this).attr("name")+"']:radio").not(this).removeData("chk");$(this).hasClass("normal")||($(this).data("chk",!$(this).data("chk")),$(this).prop("checked",$(this).data("chk")));$(this).prop("name")==="AllAsmeConsentTypeId"&&($(this).prop("checked")?disableCategories($(this).val()):disableCategories(opt_in_id))})});disableCategories=function(n){n===opt_out_id?$("#ASMEPreferenceCategories input:radio").attr("disabled","disabled"):$("#ASMEPreferenceCategories input:radio").removeAttr("disabled");afterDisableCategories()};resetIndeterminate=function(){$('#ASMEPreferenceCategories [indeterminate="true"]').attr("indeterminate",!1);$('#ASMEPreferenceCategories input[data-partial-check="true"]').attr("indeterminate",!0)}