function height() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}
function check() {
  var content = $('content_wrap');
  var footer = $('footer');
  var bottom = $('cont_bottom');
  var background = $('background');
  
  content.style.height = 'auto';
  content.style.overflow = 'hidden';
  bottom.style.display = 'none';
  
  var contentHeight = content.getCoordinates().height;
  
  if(contentHeight + 102 > (height()))
	  footer.style.position = 'relative';
  else 
	  footer.style.position = 'fixed';
	 
  background.style.height = height();
  
  if(content.offsetHeight > 840) {
	  bottom.style.display = 'block';
	  bottom.style.height = (content.offsetHeight - 840) + "px";
	  bottom.style.margin = '840px 0px 0px 0px';
  }
  
     
   setTimeout("check()", 100);
}


function check_pos() {
	alert(document.getElementById('background').offsetHeight + " " + (height()-122));
}

window.onload = function() {
check();
}