Merging these two if... else statements
<p>Sorry, I'm new to jQuery. So I have this jQuery code with two if else statement, which I want to merge 'cause I feel it's an unnecessary repetition. They are somewhat different codes, since once is acting on <code>ul#tabs li a</code> and the other on <code>ul.tabs li a</code>. How can I merge them to improve performance?  Here is the code:   </p>

<pre><code>$(document).ready(function() 
{
    var hash = location.hash;

    $(".tab_content").hide(); //Hide all content

    if ($("ul#tabs li a[href='" + hash + "']").length) 
    { 
        $("ul#tabs li a[href='" + hash + "']")
            .addClass("active")
            .parent()
            .addClass("active"); //Activate tab

        $(hash).show();
    }
    else 
    {
        do stuff
    }  

    if ($("ul.tabs li a[href='" + hash + "']").length) 
    {
        $("ul.tabs li a[href='" + hash + "']")
            .addClass("active")
            .parent()
            .addClass("active"); //Activate tab

        $(hash).show();
    }
    else 
    {
        do stuff
    }  
}); 
</code></pre>

<p>How do I merge these two codes?</p>
