//scroll script starts here var isIE = 0; var isW3c = 0; var isNS4 = 0; if (document.all) { isIE = 1; } else if (document.getElementById) { isW3c = 1; } else isNS4 = 1; function verifyCompatibleBrowser(){ this.ver=navigator.appVersion //Returns browser version this.dom=document.getElementById ? 1 : 0 //this.dom is set to 1 if its netscape 6 this.ie5=(this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0; //this.ie5 is set to 1 if the appVersion is MSIE5 and its using W3C spec this.ie4=(document.all && !this.dom) ? 1 : 0; //this.ie4 is set to 1 if the browser understands document.all but not GetElementByID this.ns5=(this.dom && parseInt(this.ver) >= 5) ? 1 : 0; //this.ns5 is set to 1 if the brow understands getElementById and version is greater than 5 this.ns4=(document.layers && !this.dom) ? 1 : 0; //this.ns4 is set to 1 if the brow understand layers but not getElementById this.brow=(this.ie5 || this.ie4 || this.ns4 || this.ns5) //this.bw is set to 1 is any of the abover are true (ie a dhtml browser) return this } //bw is set to ? var speed=50 var loop, timer function ConstructObject(obj,nest) { //Receives Div name and the name of the nested div if applicable nest=(!nest) ? '' : 'document.' + nest + '.' //If no nested div is passed, nest is set to nothing //if its W3C, this.el is set to getElementById. If not this.el = brow.dom ? document.getElementById(obj) : brow.ie4 ? document.all[obj] : brow.ns4 ? eval(nest+'document.'+obj) : 0; this.css = brow.dom ? document.getElementById(obj).style : brow.ie4 ? document.all[obj].style : brow.ns4?eval(nest+'document.'+obj) : 0; this.scrollHeight = brow.ns4 ? this.css.document.height : this.el.offsetHeight this.clipHeight = brow.ns4 ? this.css.clip.height : this.el.offsetHeight this.up = MoveAreaUp; this.down = MoveAreaDown; this.MoveArea = MoveArea; this.x; this.y; this.obj = obj + "Object" eval(this.obj + "=this") return this } function MoveArea(x,y){ this.x = x; this.y = y this.css.left = this.x this.css.top = this.y } function MoveAreaDown(move){ if(loop) { if(this.y >- this.scrollHeight + objContainer.clipHeight){ this.MoveArea(0,this.y-move) setTimeout(this.obj+".down("+move+")",speed); } } } function MoveAreaUp(move){ if(loop) { if(this.y < 0){ this.MoveArea(0,this.y-move) setTimeout(this.obj+".up("+move+")",speed); } } } function PerformScroll(speed){ if(initialised){ loop=true; if(speed>0) { objScroller.down(speed) } else objScroller.up(speed) } } function CeaseScroll(){ loop=false if(timer) clearTimeout(timer) } var initialised; function InitialiseScrollableArea(){ brow = new verifyCompatibleBrowser() objContainer=new ConstructObject('divContainer'); objScroller=new ConstructObject('divContent','divContainer'); objSize = new SetSize(); //alert(objSize.pagewidth); //testing set size and value returned //alert(objSize.pageheight); objScroller.MoveArea(0,0); objContainer.css.visibility='visible'; //alert(brow); initialised=true; window.onresize = resizeIt; } function SetSize() { //alert("calling SetSize") this.pagewidth = (brow.ns4) ? innerWidth : document.body.offsetWidth; this.pageheight = (brow.ns4) ? innerHeight : document.body.offsetHeight; return this; } function resizeIt() { objSize2 = new SetSize(); if(brow.ns4 && (objSize2.pagewidth != objSize.pagewidth || objSize2.pageheight != objSize.pageheight)) { alert("about to reload"); location.reload(true) } } // end absolutely positioned scrollable area object scripts