How can I not repeat this code in jquery?
<p>I am repeating an IF ELSE statement like so</p>

<pre><code> $('#accountLoginButton').click(function() {




  if($('#topSubscribe').is(":visible")) {

   $('#topSubscribe').slideUp(function(){


   if ($('#topLogin').is(":hidden"))
   {
     $('#topLogin').slideDown("fast");
   } else {
     $('#topLogin').slideUp("fast");
   }

   });

  } else {

    if ($('#topLogin').is(":hidden"))
   {
     $('#topLogin').slideDown("fast");
   } else {
     $('#topLogin').slideUp("fast");
   }

  }




 });



 $('#subscribeTopButton').click(function() {

  if($('#topLogin').is(":visible")) {

   $('#topLogin').slideUp(function(){


   if ($('#topSubscribe').is(":hidden"))
   {
     $('#topSubscribe').slideDown("fast");
   } else {
     $('#topSubscribe').slideUp("fast");
   }

   });

  } else {

    if ($('#topSubscribe').is(":hidden"))
   {
     $('#topSubscribe').slideDown("fast");
   } else {
     $('#topSubscribe').slideUp("fast");
   }

  }


 });
</code></pre>

<p>Basically 2 buttons operating like tabs to show/hide stuff. </p>

<p>As you can see I literally have the same code being repeated in a few different ways a couple times. I have a feeling i could somehow get this down to a few lines of code but my javascript understanding is a bit shady in general.</p>

<p>How do I trim this down the most?</p>
