$(window).bind("load", function() {

function positionFooter() {
  var windowHeight = $(window).height();
  var displayContentsHeight = $('#container').height();
  var contentsHeight = $('#container').attr('scrollHeight');
  
 if ( windowHeight > displayContentsHeight+45) {
  $('#footer').css({position: "absolute",
    top: windowHeight-45 + "px"
  });
 }else{
  $('#footer').css({position: "static"});
 }
 if ( contentsHeight < windowHeight) {
  $('html').css({height: "100%"});
 }
 
}

   $(window)
     .scroll(positionFooter)
     .resize(positionFooter);

positionFooter();



});
