// LoopScroll Object/*
 Copyright (C) 2000  e.magination network, llc.  All Rights Reserved.
   Feel free to reuse or modify this code,
   provided this header remains in tact.
   http://www.emagination.com
   jibba jabba strikes again.
*/

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

function LoopScroll(scrollname, window, content, inc, speed) {	this.scrollname = scrollname
	this.window = window
	this.content = content
	//default inc and speed values	if (!inc) inc = 8	if (!speed) speed = 20
	this.inc = inc
	this.speed = speed
	this.contentHeight = (is.ns)? this.content.doc.height : this.content.elm.scrollHeight
	this.contentWidth = (is.ns)? this.content.doc.width : this.content.elm.scrollWidth
	this.up = LoopScrollUp
	this.down = LoopScrollDown
	this.left = LoopScrollLeft
	this.right = LoopScrollRight
	this.stop = LoopScrollStop
	this.activate = LoopScrollActivate
	this.activate(this.contentWidth,this.contentHeight)
}
function LoopScrollActivate() {
	this.offsetHeight = this.contentHeight-this.window.h
	this.offsetWidth = this.contentWidth-this.window.w
	this.enableVScroll = true//(this.offsetHeight>0)
	this.enableHScroll = true//(this.offsetWidth>0)
}
function LoopScrollUp() {
	if (this.enableVScroll) {		var fn = this.content.id.replace(/Div$/,'')+".moveBy(null,-"+this.contentHeight+"/2);"+this.scrollname+".up()";		this.content.slideTo(null,0,this.inc,this.speed);	}
}
function LoopScrollDown() {
	if (this.enableVScroll) {		var fn = this.content.id.replace(/Div$/,'')+".moveBy(null,"+this.contentHeight+"/2);"+this.scrollname+".down()";		this.content.slideTo(null,-this.offsetHeight,this.inc,this.speed);	}
}
function LoopScrollLeft() {
	if (this.enableHScroll) {
		var fn = this.content.id.replace(/Div$/,'')+".moveBy(-"+this.contentWidth+"/2,null);"+this.scrollname+".left()";		this.content.slideTo(0,null,this.inc,this.speed,fn);
	}
}
function LoopScrollRight() {
	if (this.enableHScroll) {		var fn = this.content.id.replace(/Div$/,'')+".moveBy("+this.contentWidth+"/2,null);"+this.scrollname+".right()";		this.content.slideTo(-this.offsetWidth,null,this.inc,this.speed,fn);
	}
}
function LoopScrollStop() {
	this.content.slideActive = false
}
