Schwab,
var rightcolumnTop = rightcolumn.offset().top;
var columnPosition = contentWidth - rightcolumnWidth + contentLeftMargin;
var rightcolumnStop = headerHeight + popularPostHeight + contentHeight - rightcolumnHeight;
var columnPositionDown = contentWidth - rightcolumnWidth;
$(window).on("scroll resize",function(){
var scrlTop = $(this).scrollTop();
if ( scrlTop > rightcolumnTop )
{
rightcolumn.addClass("columnfixed");
rightcolumn.css({"top":"0px", "left": columnPosition - 2 +"px", "width": rightcolumnWidth+"px", });
}
if(scrlTop >= rightcolumnStop && rightcolumn.hasClass("columnfixed"))
{
rightcolumn.removeClass("columnfixed");
rightcolumn.addClass("columnabsolute");
rightcolumn.css({"top": contentHeight - rightcolumnHeight+"px", "left": columnPositionDown - 2 +"px", "width": rightcolumnWidth+"px", });
}
if(scrlTop < rightcolumnStop && rightcolumn.hasClass("columnabsolute"))
{
rightcolumn.removeClass("columnabsolute");
rightcolumn.addClass("columnfixed");
rightcolumn.css({"top":"0px", "left": columnPosition - 2 +"px", "width": rightcolumnWidth+"px", });
}
if(scrlTop <= rightcolumnTop && rightcolumn.hasClass("columnfixed"))
{
rightcolumn.removeClass("columnfixed");
}
});