Referencing mutliple ID's within a JQuery call
<p>New to Jquery and I think most of my troubles are from assumptions based on the many other languages I use.  The question right now involves the absolute traversal of an HTML id.  For example, given multiple sets of HTML with differing id's:</p>

<pre><code>&lt;div id="navi1"&gt;
    &lt;div class = "linker"&gt;
        &lt;a href="javascript:void(0)"&gt;&lt;img src="gfx/link1ver.png" /&gt;&lt;/a&gt;
        &lt;div class="expand"&gt;&lt;/div&gt;
        &lt;img src="gfx/divide1.png" /&gt;
    &lt;/div&gt;
    &lt;div id = "content1"&gt;
        test
    &lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
    var a = ['#navi0', '#navi1', '#navi2'];
    var b = ['#content0', '#content1', '#content2'];

    $(a[0] + ' .expand').css({'background-color': '#017693', 'height': '50px'});
    $(a[1] + ' .expand').css({'background-color': '#01D092', 'height': '50px'});
    $(a[2] + ' .expand').css({'background-color': '#D0013F', 'height': '50px'});

    for(i = 0; i &lt;= 2; i++) {
        $(a[i] + ' a').click(function() {

            for(j = 0; j &lt;= 2; j++) { 
                if($(a[j] + ' .expand').css('height') == '300px') {
                    $(a[j] + ' .expand').animate( {
                        height: '0px'
                    }, 500);
                    $(b[j]).animate( {
                        width: '100px'
                    }, 500);

                }
            }

            $(this).next().animate( {
                height: '300px'
            }, 500);    

            $(b[i]).animate( {
                width: '500px'
               }, 500);     

        });     
    }


&lt;/script&gt;
</code></pre>

<p>This is all just to test how Jquery works.  Regarding the question, the last animate attempts to perform on an id that isn't within the current 'this' or parent of 'this' at all.  How can I get there with this setup and is my use of array 'b' appropriate?  Would it be better to use a general class rather than unique content id's?</p>

<p>I've always been particular about good code, so by all means throw in tips however you like.</p>
