Fix div on scroll

Fix div on scroll

$(document).ready(function(){
              $(window).scroll(function(){
                  var $menu_pos = $('#menu').offset().Top;
                 if($(this).scrollTop() >= $menu_pos){
                     $('#menu').addClass('stick');
                 }else{
                     $('#menu').removeClass('stick');
                 };
              });
           });

can anyone please tell me wheres my mistake? since it is not working..

thanks in advance.