// 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/

/*
 Modified by  e.magination network, llc.  All Rights Reserved.
   http://www.emagination.com
   jibba jabba strikes again.

 modified by e.magination 20011213
 added option to change pixel increment value (incFactor) during scroll
 setting a value of 2 will make it scroll twice as fast
 setting a value of 0.5 or (1/2) will make it scroll half as fast
   or twice as slow 

 modified by e.magination 20001226
 compatible with Netscape6/Mozilla5 (is.ns5)
 NOTE: workaround used for style.left/top undefined bug 
 with use of embedded styles instead of 
 inline styles (in <div style="..."> tag)
*/

function MiniScroll(window,content,inc,speed,initx,inity) {
	//initx and inity are used for the workaround
	this.window = window
	this.content = content
	//if (is.ns5) then use workaround for style.left/top bug
	if (is.ns5) {
		if (!initx) initx = 0;
		if (!inity) inity = 0;
		this.content.moveTo(initx,inity);
	}
	this.content.slideInit();
	this.inc = 4; //default
	this.speed = 20; //default
	this.contentHeight = (is.ns)? ((is.ns4)? this.content.doc.height : this.content.h) : this.content.elm.scrollHeight;
	this.contentWidth = (is.ns)? ((is.ns4)? this.content.doc.width : this.content.w) : 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(incFactor) {
	this.content.slideActive = false;
	if (!incFactor || isNaN(incFactor)) incFactor = 1;
	if (this.enableVScroll) this.content.slideTo(null,0,incFactor*this.inc,this.speed);
}
function MiniScrollDown(incFactor) {
	this.content.slideActive = false;
	if (!incFactor || isNaN(incFactor)) incFactor = 1;
	if (this.enableVScroll) this.content.slideTo(null,-this.offsetHeight,incFactor*this.inc,this.speed);
}
function MiniScrollLeft(incFactor) {
	this.content.slideActive = false;
	if (!incFactor || isNaN(incFactor)) incFactor = 1;
	if (this.enableHScroll) this.content.slideTo(0,null,incFactor*this.inc,this.speed);
}
function MiniScrollRight(incFactor) {
	this.content.slideActive = false;
	if (!incFactor || isNaN(incFactor)) incFactor = 1;
	if (this.enableHScroll) this.content.slideTo(-this.offsetWidth,null,incFactor*this.inc,this.speed);
}
function MiniScrollStop() {
	this.content.slideActive = false;
}
