var speed=50
var loaded=0
var loop, timer
var winWidth

//Object constructor
function makeObj(obj,nest){
    nest=(!nest)?'':'document.'+nest+'.'
  	this.el=(is.ns)?eval(nest+'document.'+obj):document.all[obj]
    this.css=(is.ns)?eval(nest+'document.'+obj):document.all[obj].style
  	this.scrollHeight=(is.ns)?this.css.document.height:this.el.offsetHeight
  	this.clipHeight=(is.ns)?this.css.clip.height:this.el.clientHeight
  	this.up=goUp;this.down=goDown
  	this.moveIt=moveIt; this.x; this.y
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}
function moveIt(x,y){
  	this.x=x;this.y=y
  	this.css.left=this.x
  	this.css.top=this.y
}
function goDown(move){
  	if(this.y>-oScroll.scrollHeight+oCont.clipHeight){
    		this.moveIt(0,this.y-move)
        if(loop) setTimeout(this.obj+".down("+move+")",speed)
  	}
}
function goUp(move){
  	if(this.y<0){
    		this.moveIt(0,this.y-move)
    		if(loop) setTimeout(this.obj+".up("+move+")",speed)
  	}
}
function scroll(step){
  	if(loaded){
    		loop=true;
    		if(step>0) oScroll.down(step)
    		else oScroll.up(step)
  	}
}
function noScroll(){
  	loop=false
  	if(timer) clearTimeout(timer)
}
//Makes the object
function scrollInit(){
  	winWidth=(is.ns)? window.innerWidth-16 : document.body.clientWidth
    oCont=new makeObj('divWin')
    oScroll=new makeObj('divScrollText','divWin')
    oCont.css.left=(winWidth>=700)? winWidth/2-138 : 212
    oCont.css.visibility=(is.ns)? 'show' : 'visible'
 	  oScroll.moveIt(0,0)
    loaded=true
}
