i need assistance with some TAB code, Jquery
<p>So long story short, im working with some jquery tabs and im using this code.</p>

<pre><code>css of the tabs:

/* ---------- INNER CONTENT (ACCORDION) STYLES ----*/
.accordian {    
    background-color:#fff;
    margin:20px auto;   
    color:red;
    overflow:hidden;

}

#boxOut{
    width:320px;
    height:410px;
    overflow:scroll;
    background-color:#fff;
    margin:154px auto auto 38px;

}






/*.accordian {
    width: 400px;
    margin: 50px auto;
}
*/
.accordian li {
    list-style-type: none;
    padding: 0 8px;
}

.dimension {
/*  height: 400px;
*/}


.odd, .even {
    font-weight: bold;
    height: 27px;
    padding-top: 3px;
    padding-left: 10px;
    border: 1px solid #d8d8d8;
    background: #ececec;
    color: #333;
    border-radius: 8px; 
-moz-border-radius: 8px; 
-webkit-border-radius: 8px;
margin-left:6px;
margin-right:6px; 

}

.logo{
    width:300px;
    margin:6px auto;
}

.intownLogo{
    width:255px;
    margin:6px auto;
}

.spaces{
    margin-top:8px; 
}
</code></pre>

<p>js:</p>

<pre><code>   $(function() {
        // Hide all the content except the first
        //$('.accordian li:odd:gt').hide();
        $('.accordian li:odd').hide();


        // Add the dimension class to all the content
        $('.accordian li:odd').addClass('dimension');

        // Set the even links with an 'even' class
        $('.accordian li:even:even').addClass('even');

        // Set the odd links with a 'odd' class
        $('.accordian li:even:odd').addClass('odd');

        // Show the correct cursor for the links
        $('.accordian li:even').css('cursor', 'pointer');

        // Handle the click event
        $('.accordian li:even').click( function() {
            // Get the content that needs to be shown
            var cur = $(this).next();

            // Get the content that needs to be hidden
            var old = $('.accordian li:odd:visible');

            // Make sure the content that needs to be shown 
            // isn't already visible
            if ( cur.is(':visible') )
                return false;

            // Hide the old content
            old.slideToggle(500);

            // Show the new content
            cur.stop().slideToggle(500);

        } );
    });
</code></pre>

<p>My jquery is noobish at best so although i undestand what its doing, i cant edit it without breaking it...lord knows ive tried lol. </p>

<p>The part im having problems with is that, with these tabs, although they work, they work with the .next() functions etc, so when a tab is open, if i click the same tab to close, it doesn't close, it only closes when another tab is clicked.</p>

<p>What im needed help with is ....something that says</p>

<p>"logic" if this tab is already open and is clicked, close the current open tab.
so that said, for example, based on the code above</p>

<p>pseudo code coming:</p>

<pre><code>if ( cur.is(':visible') &amp;&amp; cur.is(':clicked') )
        cur.slideToggle();
</code></pre>

<p>Thanks for your help in advanced.</p>
