jquery tab switcher
<p>I have the below script:</p>

<pre><code>var SwitchTabs = function(container, tabs, activeclass, which) {
var tabContainers = $(container + ' &gt; div');
var index = 0;
var tabnum = (which) ? parseInt(which) - 1 : 0;
tabContainers.filter(':eq(' + tabnum + ')').css({'display':'block'});
$(container + ' &gt; ' + tabs).find('a').click(function(){
    index = $(this).parent().index();
    tabContainers.css({'display':'none'}).filter(':eq(' + index + ')').show();
    $(container + ' ' + tabs + ' ' + ' a').removeClass(activeclass);
    $(this).addClass(activeclass);
}).filter(':eq(' + tabnum + ')').click();
}

$(function(){
SwitchTabs('div.tabs', 'ul.mostpouplar', 'active', 1);
});
</code></pre>

<p>Mark up:</p>

<pre><code>
    &lt;div class="tabs rrmodule"&gt;
    &lt;h3&gt;Popular&lt;/h3&gt;
    &lt;ul class="mostpopular"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Most Viewed&lt;/a&gt;&lt;/li&gt; 
        &lt;li&gt;&lt;a href="#"&gt;Most Commented&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;

    &lt;div&gt;
    Some content - tab 1
    &lt;/div&gt;
    &lt;div&gt;
    Some content - tab 2
    &lt;/div&gt;
    &lt;/div&gt;
</code></pre>

<p>The above (as per the code) should should set a class to the first anchor element and show the 1st DIV on page load. Then DIVs are shown and anchor class is set according to the click. I am using jquery 1.4.4. For some reason click does not work, neither the onload setting the class and showing the DIV don't work! I think the code is quite straightforward. Can someone help me with this please.</p>

<p>Thanks,
L</p>
