function setFooter(){

  var body_h    = null;
  var window_h  = null;

  body_h    = $("body").height();
  window_h  = $(window).height();

  if ( window_h > body_h ) {
    $("#footer").css('position', 'absolute');
    $("#footer").css('bottom', '0px');
  } else {
    $("#footer").css('position', 'relative');
  }

}

$(document).ready(function(){
  $('#footer_wrapper').hide();
  setFooter();
  $(window).resize(setFooter);
  $(".expand").click(function() {
    $("#footer").css('position', 'relative');
    $("#footer").animate({height: 500}, 500, function() {
      $("html").animate({ scrollTop: $(document).height() }, "slow", function() {
        $('#footer_wrapper').fadeIn("slow");
      });
    });
  });
});



