$(function() {
   $(".signin").click(function(e) {
        e.preventDefault();
        $("#signin_menu").toggle();
        $(".signin").toggleClass("menu-open");

    });
            $("#signin_menu").mouseup(function() {
                return false
            });
            $(document).mouseup(function(e) {
                if($(e.target).parent("a.signin").length==0) {
                    $(".signin").removeClass("menu-open");
                    $("#signin_menu").hide();
                }
            });   
    
});

$(function () {  
  var top = $('#subnav').offset().top - parseFloat($('#subnav').css('marginTop').replace(/auto/, 0));
  $(window).scroll(function (event) {
    // what the y position of the scroll is
    var y = $(this).scrollTop();
  
    // whether that's below the form
    if (y >= top) {
      // if so, ad the fixed class
      $('#subnav').addClass('fixed');
    } else {
      // otherwise remove it
      $('#subnav').removeClass('fixed');
    }
  });
});

