jQuery(document).ready(function($)
{
    fixContentBackground();
});

jQuery(window).resize(function($)
{
    fixContentBackground();
});

jQuery(window).load(function($)
{
    fixContentBackground();
});

jQuery(window).scroll(function($)
{
    fixContentBackground();
});

var lastRunContentboxHeight = null;
function fixContentBackground()
{

     var topHeight    = $('.contentBox .contentBackgroundTop').height();
     var bottomHeight = $('.contentBox .contentBackgroundBottom').height();

     var contentBoxHeight = $('#contentBox').height();
     if (contentBoxHeight == lastRunContentboxHeight)
     {
         return;
     }

     $('.contentBackgroundLoop').height( contentBoxHeight - topHeight - bottomHeight);
     $('.contentBox').removeClass('staticBackground');

     window.lastRunContentboxHeight = contentBoxHeight;

}
