function scheight() { return ('pageYOffset' in window) ? window.pageYOffset : document.compatMode === "BackCompat" && document.body.scrollTop || document.documentElement.scrollTop } function getleft(obj) { return $jq(obj).offset().left } function gettop(obj) { return $jq(obj).offset().top } function getheight(obj) { return $jq(obj).css("height").replace("px", "") - 0 } menuheight = getheight($("menu")); pa = $jq("td.postauthor[rowspan=2]"); ph = new Array(); pb = new Array(); function interauthor() { pa = $jq("td.postauthor[rowspan=2]"); for (i = 0; i < pa.length; i++) { pb[i] = $jq(".author")[i]; ph[i] = [gettop(pa[i]) - menuheight, gettop(pa[i]) + getheight(pa[i]) + (pa.eq(i).css("padding-top").replace("px", "") - 20), getheight(pb[i]) + gettop(pa[i])] } }; $jq(document).ready(function() { function windowscroll() { interauthor(); var st = scheight(); for (i = 0; i < pa.length; i++) { if (ph[i][0] < st) { if (st - ph[i][0] < ph[i][1] - ph[i][2]) { pb[i].style.position = "fixed"; $jq(pa[i]).css("padding-top", "0px") } else { pb[i].style.position = ""; $jq(pa[i]).css("padding-top", (ph[i][1] - ph[i][2]) + "px") } } else { pb[i].style.position = ""; $jq(pa[i]).css("padding-top", "0px") } } } $jq(document).scroll(function() { windowscroll() }) });