why does callback happen early???

why does callback happen early???

Please, someone explain this to me. The jquery docs page for slideup specifically says "Hide all matched elements by adjusting their height and firing an optional callback after completion.".

Yet when you simply do the following the javascript alert will fire before the animation, not after completion like it says.

WHY?


<html>
<head>
<script language="JavaScript" type="text/javascript" src="/scripts/jquery-1.3.2.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$(".btn-slide").click(function()
{
if ($("#panel").is(":visible")) { $("#panel").slideUp("slow", alertpopup()); }
$(this).toggleClass("active"); return false;
});
});

function alertpopup()
{
alert('this pops up BEFORE the animation, not after');
}
</script>
</head>

<body>
<a href="#" class="btn-slide">Click this to close</a>
<BR>
<div id="panel" style="background-color: red;"><BR><BR>test<BR><BR><BR></div>
</body>
</html>