$(document).ready(function() {
    checkFooter(true, false);
});

function checkFooter(continuous, finish){
    if(finish){
        clearInterval(footerCheckInterval);
        footerCheckInterval=null;
    }
    var container=$("#mainContent");
    var footer=$("#footer");
    var availableHeight=$(window).height();
    
    var contentHeight = container.innerHeight()+(!isNaN(container.offsetTop)?container.offsetTop:0)+footer.innerHeight();
    
    //alert (contentHeight+' | '+availableHeight);
    
    if(contentHeight<availableHeight-75){
      footer.css("position", "absolute");
      footer.css("top", availableHeight-75+"px");
    }
    footer.css("visibility", "visible");
    if(continuous) footerCheckInterval=setInterval("checkFooter()", 10);
}
