﻿var gTop = 0; var gIncVal = 0; var timeOutValue = 10; var barHeight = 220; function scrollMe(a) { var b = document.getElementById("text_area"); var e = 210; var d = parseInt(b.offsetHeight); var c = b.style.top; if (!c) { c = 0 } else { c = c.substring(0, c.length - 2) } if (a > 0) { if (c >= 0 || c > (-(d - (barHeight + e)))) { incrementValue = e } else { if (c < (-(d - (barHeight + e)))) { incrementValue = (d - barHeight) + parseInt(c) } else { incrementValue = 0 } } encSmoothScroll("minus", parseInt(c), parseInt(incrementValue)) } else { if (c < 0 && ((parseInt(c) + e) < 0)) { incrementValue = e } else { incrementValue = -c - 0 } encSmoothScroll("plus", parseInt(c), parseInt(incrementValue)) } } function encSmoothScroll(c, b, a) { gTop = b; gIncVal = a; encScrollBy(c, 0) } function encScrollBy(b, d) { if (d < gIncVal) { var e; if ((gIncVal - d) > 1) { e = Math.ceil((gIncVal - d) / 10); if (e < 1) { e = 1 } } else { e = gIncVal - d } d += e; var a = document.getElementById("text_area"); if (b == "plus") { a.style.top = gTop + d + "px" } else { if (b == "minus") { a.style.top = gTop - d + "px" } } var c = setTimeout("encScrollBy('" + b + "', " + d + ");", timeOutValue) } else { clearTimeout(c) } };
