Changing functions based on checkbox being checked or not
<p>I have the same function checking 2 different text input fields in a form.  If a checkbox is checked, I need the function to run on one of the text input fields.  If the checkbox is not checked, I need the function to run on the other text input field.</p>

<p>Here is the checkbox:</p>

<pre><code>&lt;input id="use_different_addresses" type="checkbox" value="1" name="use_different_addresses" /&gt;Use different address&lt;br /&gt;
</code></pre>

<p>By default the checkbox is not checked.  When unchecked, I need this function to run:</p>

<pre><code>$('#customer_country_name').change(function() {
    if ($('#customer_country_name').val() != 'United States') {
        $('.radio_us').hide();
    }
    else {
        $('.radio_us').show();
    }
});
</code></pre>

<p>When the checkbox is checked, I need this function to run:</p>

<pre><code>$('#shipping_country_name').change(function() {
    if ($('#customer_country_name').val() != 'United States') {
        $('.radio_us').hide();
    }
    else {
        $('.radio_us').show();
    }
});
</code></pre>

<p>Thanks!</p>
