(function ($) {
    $.extend({
        vmAnnouncementVisibility: function (modelName, metaList)
        {
            setDropdownVisibility(modelName, metaList);
            function setDropdownVisibility(modelName, metaList) {
                $.each(metaList, function (i, value) {
                    setDropdownVisibilityByID(modelName + '_' + value + '_meta');
                    $('#' + modelName + '_' + value).on('change', function () {
                        setDropdownVisibilityByID(modelName + '_' + value + '_meta');
                    });
                });
            }

            function setDropdownVisibilityByID(id) {
                var parentDropdown = $('#' + id.replace('_meta', ''));
                if (parentDropdown.val().split('_')[0] === '11' || parentDropdown.val().split('_')[0] === '12') {
                    $('#' + id).parent().parent().show();
                } else {
                    $('#' + id).val('');
                    $('#' + id).parent().parent().hide();
                }
            }

        }
    });
}(jQuery));