finding the state of slideToggle

finding the state of slideToggle

I have a slideToggle functioning just fine on my page:

http://www.viktorwithak.com/Test/nav/

But I'm trying to get it to set a cookie that remembers what is closed and what is open. So, step one, I'm trying to determine (on click) what the state of slideToggle is. Here is my code so far...
function initMenu() {
   $('#groups ul').hide();
   $('#groups li a').click(
      function() {
         $(this).next().slideToggle('normal');
         var id = $(this).attr('id');
         if ($(this).next().is(':hidden')) {
            var state = "closed";
         } else if ($(this).next().is(':visible')) {
            var state = "open";
         }
         alert($(this).next().attr('id') + ' is ' + state);
         return false;
      }
   );
}

...but everytime I click, it tells me "slide_# is open."
Can you please take a look at my if statements and let me know how to
determine the slide_toggle state? Once I get that working, I should be
able to figure out myself how to update the cookie. Thanks![/code]