﻿(function($) {
    $.fn.toggleField = function(show) {
        return this.each(function() {
            var input = this;
            $(input).parents('tr').toggle(show);
            $(input).attr({ disabled: !show }).siblings('span').toggle(show);
            if (show) {
                $(input).removeClass('disabled');
            } else {
                $(input).addClass('disabled').removeClass('missing invalid');
            }
        });
    }
})(jQuery);
