// Version 0.9 Beta

// Basic Functions ------------------------------------------------------------------------------------------------------

function MoveObj (x, y) { this.x=x; this.y=y; this.css.left=x; this.css.top=y; }
function MoveObjH (move) { this.MoveObj(this.x+move, this.y) }
function MoveObjV (move) { this.MoveObj(this.x, this.y+move) }
function ShowObj () { bw.ns4?this.css.visibility='show':this.css.visibility='visible' }
function HideObj () { bw.ns4?this.css.visibility='hide':this.css.visibility='hidden' }

// Special Functions ------------------------------------------------------------------------------------------------------

function ScrollObj (move, speed) {
	if ((move<0 && this.y>this.parent.clipHeight-eval(this.childName).scrollHeight)||(move>0 && this.y<0)) {
		this.MoveObjV(move);
		if (this.loop) timerID=setTimeout(this.obj+".ScrollObj("+move+")", speed)
	}
}
function StartScroll (move, speed) { if (initialised) {this.loop=true;this.ScrollObj(move, speed)}}
function StopScroll () { if (initialised) { this.loop=false; if (timerID) clearTimeout(timerID)}}

function ScrollV (move, speed, pos) {
	if (this.y>pos) {
		this.MoveObjV (-move);
	} else if (this.y<pos) {
		this.MoveObjV (move);
	}
	if (Math.abs(pos-this.y)<move) {
		this.MoveObj (this.x, pos)
		this.loop=false;
	}
	if (this.loop) timerID=setTimeout(this.obj+".ScrollV("+move+","+speed+","+pos+")", speed)
}

function ScrollH (move, speed, pos) {
	if (this.x>pos) {
		this.MoveObjH (-move);
	} else if (this.x<pos) {
		this.MoveObjH (move);
	}
	if (Math.abs(pos-this.x)<move) {
		this.MoveObj (pos, this.y)
		this.loop=false;
	}
	if (this.loop) timerID=setTimeout(this.obj+".ScrollH("+move+","+speed+","+pos+")", speed)
}