jQuery(document).ready(function($) {
afixed();
});
function afixed() {
if (!jQuery('.afixed').length) { return; }
top_position = jQuery('#footer_menu').height() + 500;
bottom_position = jQuery('#footer_menu').height();
jQuery('.afixed').affix({
offset: {
top: top_position,
bottom: bottom_position
}
});
};