<script>
window.onload =
function () {
var oDiv = document.getElementById("topads"),
H = 0,
Y = oDiv
w = document.body.clientWidth / 2;
w = 0 - w;
while (Y) {
H += Y.offsetTop;
Y = Y.offsetParent;
}
window.onscroll = function () {
var s = document.body.scrollTop || document.documentElement.scrollTop
if (s > H) {
oDiv.style = "position:fixed;top:0; z-index:99;margin-left:"+ w +"";
} else {
oDiv.style = ""
}
}
}
</script>