// MiniScroll Object
// gives controls to a set of 2 layers for scrolling
// 19990410

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynduo/

function MiniScroll(window,content) {//alert("MiniScroll(' "+window+" ',' "+content+" ')");
	this.window = window
	this.content = content
	this.content.slideInit()
	this.inc = 8
	this.speed = 100

	this.contentHeight = (is.ns4)? this.content.doc.height : ((is.ns5)? this.content.elm.offsetHeight : this.content.elm.scrollHeight);
	this.contentWidth = (is.ns4)? this.content.doc.width : ((is.ns5)? this.content.elm.offsetWidth :this.content.elm.scrollWidth);

	this.up = MiniScrollUp
	this.down = MiniScrollDown
	this.left = MiniScrollLeft
	this.right = MiniScrollRight
	this.stop = MiniScrollStop
	this.activate = MiniScrollActivate
	this.activate(this.contentWidth,this.contentHeight)
}
function MiniScrollActivate(w,h) {
	this.offsetHeight = h-this.window.h
	this.offsetWidth = w-this.window.w
	this.enableVScroll = (this.offsetHeight>0)
	this.enableHScroll = (this.offsetWidth>0)
}
function MiniScrollUp(inc) {
	// ab hier api geaendert
	if (inc) {
		incc = this.offsetHeight - inc
		if (this.enableVScroll) this.content.slideTo(null,-inc,incc,this.speed);
	} else {
		if (this.enableVScroll) this.content.slideTo(null,0,this.inc,this.speed)
	}
	// bis hier, vorher nur die folgende nun auskommentierte Zeile
	//if (this.enableVScroll) this.content.slideTo(null,0,this.inc,this.speed)
}
function MiniScrollDown(inc) {
	// ab hier api geaendert
	if (inc) {
		if (this.enableVScroll) this.content.slideTo(null,-inc,inc,this.speed);
	} else {
		if (this.enableVScroll) this.content.slideTo(null,-this.offsetHeight,this.inc,this.speed)
	}
	// bis hier, vorher nur die folgende nun auskommentierte Zeile
	//if (this.enableVScroll) this.content.slideTo(null,-this.offsetHeight,this.inc,this.speed)
}
function MiniScrollLeft() {
	if (this.enableHScroll) this.content.slideTo(0,null,this.inc,this.speed)
}
function MiniScrollRight() {
	if (this.enableHScroll) this.content.slideTo(-this.offsetWidth,null,this.inc,this.speed)
}
function MiniScrollStop() {
	this.content.slideActive = false
}

