﻿jQuery.fn.clarify = function(targetId) {

    return $(this).each(function() {
        var target;

        if (targetId)
            target = $('#' + targetId);
        else
            target = $(this).parent().next().children('input');

        if ($(this).children(':selected').hasClass('rc')) {
            target.parent().show();
            target.focus();
        }
        else {
            target.parent().hide();
        }
        $(this).change(function() {
            if ($(this).children(':selected').hasClass('rc')) {
                target.parent().show();
                target.focus();
            }
            else {
                target.parent().hide();
            }
        });
    });
};
