$(document).ready(function(){
	resizing();
	$(window).resize(function() {
	  resizing();
	});
	
	$('body').css('height',$(document).height());
});


function resizing(){
	var topF = $('div#main_menu').position().top; 
	var heightF = $('div#main_menu').height();
	if((topF + heightF) < ($(document).height() - heightF)){
		$('div#main_menu').css({
			position: 'absolute',
			top: $(document).height() - 40 - (heightF+parseInt($('div#main_menu').css('paddingTop')))
		});
	}
}


