function toggle_scroll() { 15 if (scrolling) { 16 scrolling = false; 17 clearTimeout(scroll_timer); 18 } else { 19 scrolling = true; 20 scroll_chat(20); 21 } 22 } 23 function scroll_chat(n) { 24 var cd = document.getElementById('chat_div'); 25 var scroll_max = cd.scrollHeight - cd.clientHeight; 26 var scroll_pos = cd.scrollTop; 27 scroll_pos += n; 28 if (scroll_pos > scroll_max) { 29 scroll_pos = scroll_max; 30 } else if (scroll_pos < 0) { 31 scroll_pos = 0; 32 } 33 cd.scrollTop = scroll_pos; 34 scroll_timer = setTimeout('scroll_chat('+n+')', 50); 35 } 36