Fade in and out depending on div id
<p>I have a jquery code to distinct between two divs </p>

<pre><code>$("#addresslink").click(function() {
    $("#main").find("div").each(function(n,i){
        var id = this.id;
        if(id == "addressdiv")
        {
            $('#' + id).fadeIn(300);
        }
        else
        {
            $('#' + id).fadeOut(250);
        }
    });

});


$("#storylink").click(function() {
    $("#main").find("div").each(function(n,i){
        var id = this.id;
        if(id == "storydiv")
        {
            $('#' + id).fadeIn(300);
        }
        else
        {
            $('#' + id).fadeOut(250);
        }    
    });

});
</code></pre>

<p>is there a better way to tie a  to a div rather than hardcoding each  to a  then showing and hiding the other divs?</p>

<p>P.S: I have done the code just asking whether could i optimize this?</p>
