function hide(obj) {
       var startPos = -obj.next().height()-70;
       obj.removeClass("active").next().show().animate({top: startPos}, {duration: 400, easing: "easeOutStrong"});

}
$(document).ready(function() {
       $("#nav a[href='#']").click(function(e) {
               e.preventDefault();
               e.stopPropagation();
               if ($(this).hasClass("active")) {
                       hide($(this));

               } else {
                       hide($("#nav .active"));
                       $(this).addClass("active").next().show().animate({top: 0}, {duration: 400, easing: "easeInStrong"});
               }
       });
       $("#nav ol").each(function() {

               $(this).css("top", -$(this).height()-70);
       });
}).click(function() {
       if ($("#nav .active")) {
               hide($("#nav .active"));
       }
});