//-- compatibleBlowser function compatibleBlowser () { this.ver = navigator.appVersion; this.dom = (document.getElementById) ? 1 : 0; this.ie5 = (this.ver.indexOf("MSIE") > -1 && this.dom) ? 1 : 0; this.ie4 = (document.all && !this.dom) ? 1 : 0; this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; this.ns4 = (document.layers && !this.dom) ? 1 : 0; this.bwf = (this.ie5 || this.ie4 || this.ns5 || this.ns4); return this; } bw = new compatibleBlowser(); //alert(bw.ver); //alert(bw.dom); //alert(bw.bwf); var mySpeed = 40; var timer; function moveArea(x,y){ this.x = x; this.y = y; this.css.top = this.y; this.css.height = this.x; } function moveAreaUp(e){ if(this.y > (objContainer.clipHeight - this.scrollHeight)){ this.movearea(0,this.y+e); if(loop){ timer = setTimeout(this.objname + '.up(' + e + ')',mySpeed); } } } function moveAreaDown (e){ if(this.y < 0){ this.movearea(0,this.y+e); if(loop){ timer = setTimeout(this.objname + '.down(' + e + ')' , mySpeed); } } } function scrollStart(speed){ if(initFlag){ loop = true; if(speed < 0){ objContent.up(speed); } else { objContent.down(speed); } } } function scrollStop (){ loop = false; if(timer) clearTimeout(timer); } function constructObject (obj,nest){ nest = (!nest) ? '' : 'document.' + nest + '.'; this.el = (bw.dom) ? document.getElementById(obj) : (bw.ie4) ? document.all[obj] : (bw.ns4) ? eval(nest + 'document.' + obj) : 0; this.css = (bw.dom) ? document.getElementById(obj).style : (bw.ie4) ? document.all[obj].style : (bw.ns4) ? eval(nest + 'document.' + obj) : 0; this.scrollHeight = (bw.ns4) ? this.css.clip.height :this.el.offsetHeight; this.clipHeight = (bw.ns4) ? this.css.clip.height :this.el.offsetHeight; this.movearea = moveArea; this.up = moveAreaUp; this.down = moveAreaDown; this.x; this.y; this.objname = obj + 'Object'; eval(this.objname + "=this"); return this; } var initFlag = false; var loop = false; function initScrollArea (){ objContainer = new constructObject('divContainer'); objContent = new constructObject('divContent' , 'divContainer'); objContent.movearea(0,0); objContainer.css.visibility = 'visible'; initFlag = true; }