Refactor some javascript
<p>I have two nearly identical functions, but I'm not sure how I can refactor this so they can share the same logic.  </p>

<pre><code>function Content_chkClick(obj) {
    var frame = $('#iFM')[0];

    if (frame.contentWindow.Content_chkClick) {
        frame.contentWindow.Content_chkClick(obj);
    } else {
        $('.TabContent', frame.contentWindow.document).each(function () {
            var frame = this;
            if (frame.contentWindow.Content_chkClick) {
                frame.contentWindow.Content_chkClick(obj);
            }
        });
    }
}

function Content_invokeClickEvent(id) {
    var frame = $('#iFM')[0];

    if (frame.contentWindow.Content_invokeClickEvent) {
        frame.contentWindow.Content_invokeClickEvent(id);
    } else {
        $('.TabContent', frame.contentWindow.document).each(function () {
            var frame = this;
            if (frame.contentWindow.Content_invokeClickEvent) {
                frame.contentWindow.Content_invokeClickEvent(id);
            }
        });
    }
}
</code></pre>

<p>Ultimately, what I want to be able to do is just have something like</p>

<pre><code>function Content_chkClick(obj) {
    someCommonFunction(Content_chkClick, obj);
}
function Content_invokeClickEvent(id) {
    someCommonFunction(Content_invokeClickEvent, id);
}
</code></pre>
