
$(document).ready(function(){
  
	if( $("div#hmFooter").hasClass("desktop") )
	{
	
		$("div.hmFooterContainer").hover(   
			function () {
				//hideHmFooter();
				
				$("div.hmFooterContent" , $(this) ).show();
	
			}, 
			function () {
				$("div.hmFooterContent" , $(this) ).hide();
			}
		);
		
		
		
	
		$(window).scroll(function(){
			showHmFooter();
		});
	
		$(window).bind("resize", function(){  
			showHmFooter();
		});
			
		showHmFooter();
	
	}
	
});	

function showHmFooter()
{
	if(isScrollBottom())
	{
		$("div#hmFooter").show();
	}
	else
	{
		$("div#hmFooter").hide();	
	}
}

function isScrollBottom() 
{
	var documentHeight = $(document).height();
	
	var scrollPosition = $(window).height() + $(window).scrollTop();
	
	return (documentHeight <= ( scrollPosition + 29 ) );
} 
	
