$(document).ready(function() {
	
	//alert($(window).height());
	//alert($(document).height());
	
	if ($(document).height() - $(window).height() < 10){
		$('#nav-main').css('bottom', '0px');
	}
	
	$(document).scroll(function(){
		
		//alert($(window).scrollTop());
		//alert($(document).height() - $(window).height());
		
		if ( $('body').hasClass('ie6') == false && 
		 $('body').hasClass('ie7') == false && 
		 $('body').hasClass('ie8') == false ){
		
			if ($(window).scrollTop() >= $(document).height() - $(window).height() - 100){
				$('#nav-main').animate({
					bottom: 0
				}, 200);
			}else{
				$('#nav-main').animate({
					bottom: -70
				}, 200);
			}
			
		}
		
		
		//alert($(window).scrollTop());
		//alert('scroll');
	});
	
	$('#nav-main').hover(function(){
		
		
		$(this).animate({
			bottom: 0
		}, 300);
		
	}, function(){
		
		if ($(window).scrollTop() < $(document).height() - $(window).height() - 100 ||
			$('body').hasClass('ie6') || 
		 	$('body').hasClass('ie7') || 
		 	$('body').hasClass('ie8')){
			
			$(this).animate({
				bottom: -70
			}, 300);
			
		}
		
	});
	
	
	
});
