var navPos = $('#main-navigation').offset().top;
$(window).scroll(function(){
if ($(this).scrollTop()>=navPos) {
$('#main-navigation').addClass('fixed');
} else {
$('#main-navigation').removeClass('fixed');
}
});
#main-navigation.fixed {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10;
margin-top: 0;
}