<script>
$(document).ready(function() {
var $window = $(window),
$navigation = $("#menu");
$window.scroll(function() {
if (!$navigation.hasClass("fixed") && ($window.scrollTop() > $navigation.offset().top)) {
$navigation.addClass("fixed").data("top", $navigation.offset().top);
}
else if ($navigation.hasClass("fixed") && ($window.scrollTop() < $navigation.data("top"))) {
$navigation.removeClass("fixed");
}
});
});
</script>
#menu.fixed {
position: fixed;
left: 410px;
margin-left: 0px;
top: 0;
margin-top: -20px;
}