Jquery sliding element down and up with the same link not working
<p>I have the following code, it slides down, but not up. Please could you help me find the error, and also if maybe there is a better way to do this, I have tried slideToggle, but that does not make it possible to check the state of the element, for where using hide and show you can check <code>$('#my_div').is(':hidden')</code>.</p>

<p>Here is my code:</p>

<pre><code>$("a.advanced_search_toggle").click(function() { 
    if ($("#advanced_search_box").hasClass('closed')) {
        $("#advanced_search_box").slideDown(function(){
            $("a.advanced_search_toggle").text('Simple Search');
            $("a.advanced_search_toggle").removeClass('down_arrow');
            $("a.advanced_search_toggle").addClass('up_arrow')
            $("a.advanced_search_toggle").removeClass('closed');
            $("a.advanced_search_toggle").addClass('open'); 
        });
    } else {
        $("#advanced_search_box").slideUp(function(){
            $("a.advanced_search_toggle").text('Advanced Search');
            $("a.advanced_search_toggle").removeClass('up_arrow');
            $("a.advanced_search_toggle").addClass('down_arrow');
            $("a.advanced_search_toggle").removeClass('open');
            $("a.advanced_search_toggle").addClass('closed');                       
        });         
    }
    return false;
}); 
</code></pre>

<p>Please note that by default I add a class of closed to <code>#advanced_search_box</code></p>
