var h_scrollIntervalId = null; function _shMove(s) { var div = document.getElementById("hscroll"); div.scrollTop+=s; return div.scrollHeight != div.scrollTop + div.clientHeight; } function shMove(left) { if (_shMove(left ? -2 : 2)) { if (!h_scrollIntervalId) { h_scrollIntervalId = setInterval("shMove("+left+")",5); } } else { shStop(); } } function sLeft() { shMove(true); } function sRight() { shMove(false) } function shStop(){ clearInterval(h_scrollIntervalId); h_scrollIntervalId = null; } function shWheel(e) { if (!h_scrollIntervalId) { _shMove(-e.wheelDelta); } } function shInit() { var imLeft = document.getElementById("sleft"); var imRight = document.getElementById("sright"); var div = document.getElementById("hscroll"); if (!div) return; if (window.showModalDialog) { if (imLeft) { imLeft.attachEvent("onmousedown", sLeft); imLeft.attachEvent("onmouseup", shStop); imLeft.attachEvent("onmouseout", shStop); } if (imRight) { imRight.attachEvent("onmousedown", sRight); imRight.attachEvent("onmouseup", shStop); imRight.attachEvent("onmouseout", shStop); } div.attachEvent("onmousewheel", shWheel); } else { if (imLeft) { imLeft.onmousedown = sLeft; imLeft.onmouseup = shStop; imLeft.onmouseout = shStop; } if (imRight) { imRight.onmousedown = sRight; imRight.onmouseup = shStop; imRight.onmouseout = shStop; } div.onmousewheel = shWheel; } } shInit();