function sizeSidebar() {
  var yScroll;
  if (window.innerHeight && window.scrollMaxY) {yScroll = window.innerHeight + window.scrollMaxY;}
  else if (document.body.scrollHeight > document.body.offsetHeight) {yScroll = document.body.scrollHeight;}
  else {yScroll = document.body.offsetHeight;}

  var windowHeight = document.documentElement.clientHeight;

  if (yScroll < windowHeight) {pageHeight = windowHeight;}
  else {pageHeight = yScroll;}

  var fullHeight = document.getElementById('content').offsetHeight;
  var smallHeight = windowHeight - 193;

  document.getElementById('sidebar').style.height = (fullHeight > smallHeight) ? fullHeight + 'px' : smallHeight + 'px';
}

window.onload = sizeSidebar;
