Use a class to designate whether the menu is up or down:
$('#button').click(function(){
var $bar = $('.bar');
var isUp = $bar.hasClass('up');
var isAnimating = $bar.is(':animated');
// Either this menu is already down or it's animating,
// so don't register the click
if(!isUp || isAnimating) {
return;
}
// Slide down the menu
$bar.removeClass('up').animate({
marginTop: "0"
}, function(){
$('.bar input').focus();
})
})