Javascript named, self-calling function
<p>Hey guys, I have a couple bits of code that seem like they could be condensed but I'm not sure how.</p>

<p>The code I have is this</p>

<pre><code>var checkForUnitReferred = function () {
    $("#LeadForm").toggle($("#Claim_UnitReferredNoNull").is(":checked"));
};
checkForUnitReferred();

$("#Claim_UnitReferredNoNull").change(function() {
    checkForUnitReferred();        
});
</code></pre>

<p>It basically checks if a checkbox is checked and displays a form, otherwise it hides it. What I would rather have is something like this</p>

<pre><code>var checkForUnitReferred = (function() {
    $("#LeadForm").toggle($("#Claim_UnitReferredNoNull").is(":checked"));
})();

$("#Claim_UnitReferredNoNull").change(function() {
    checkForUnitReferred();        
});
</code></pre>

<p>I know this doesn't work but I think something like that would be cleaner. Anyone know of a way to accomplish this?</p>
