function stretchBody(){
 var H=0;
 with(document){
  if(window.innerHeight)
   H=window.innerHeight;
  else if(document.documentElement && documentElement.clientHeight)
   H=documentElement.clientHeight;
  else
   H=body.offsetHeight;
 }
 var pad=H-$('#content').height()-$('#footer').height();
 //alert(H + ' ' + $('#content').height() + ' ' + $('#footer').height());
 if(pad > 0)
  $('#content').css('padding-bottom', pad);
}

function preloadSidebarImages(){
 $.each($('#right_side_column .rotating_image'),function(i){
  var i=new Image();
  i.src=this.src;
 });
}

function initSidebarImages(){
 var imgs=$('#right_side_column .rotating_image');
 if(!imgs.length)return;
 var random=Math.ceil(Math.random()*imgs.length);
 $.each(imgs, function(){$(this).hide();});
 $(imgs[random]).fadeIn(300);
 setTimeout('initSidebarImages();', 3000);
}

/* when document ready - load JS */
$(document).ready(function(){
 preloadSidebarImages();
 stretchBody();
 initSidebarImages();
});

