/* The Amazing EZ Read Bible Autoscroller! 
 *
 * THIS CODE IS HEREBY PLACED INTO THE COPYRIGHTED. 
 * Please feel free to contact me with your comments/etc.
 * (ezreadbible@yahoo.com) March 2007
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

if (window != window.top) {top.location.href = location.href;}

var y=0;
var lasty=0;
var uagent=navigator.userAgent;
var hop = 0;
var aieee=0;
var scratch;
var workInterval = 0;
var scrollInterval = -2;
var cruft = 0

if(!document.getElementById && document.all)
	document.getElementById = function(id)
	{
		return document.all[id];
	}

if ((uagent.indexOf("MSIE") > 0) && (uagent.indexOf("Mac")) < 0) {
	aieee = 1;
}

/* 
 * 
 */
if (document.layers) {
	cruft = 1
}

function getScrollRate(){
	if (cruft) {
		return document.layers[0].document.speedy.ss.options[document.layers[0].document.speedy.ss.selectedIndex].value;
	} else {
		return document.getElementById("speedy").ss.options[document.getElementById("speedy").ss.selectedIndex].value;
	}
}

function scroller() {
	if (cruft) {
	   y = getY() + 3;
	} else {		
	   y = getY() + 1;
	}
	top.scroll(0,y);
	if (aieee || cruft) {
		holdwork();
	}
	return true;
}

/* 
 * 
 * 
 */
function runScroller() {
	if (aieee) {
		document.writeln( '<DIV ID="floatScroll" style="position:absolute; right: 30; top: 0;">' );
	} else {
		if (cruft) {
 			document.writeln( '<LAYER name="floatScroll">' );  
		}
		else {
			 document.writeln( '<DIV ID="floatScroll" style="position: fixed; right: 30; top: 0;">' );
		}
	}
	document.writeln('<table border=0>');
	document.writeln('<tr><td>');
	document.writeln('<FORM name="speedy" id="speedy">');
	
	document.writeln('<input type="button" Value=". B a c k ." onClick="self.history.go(-1)">');
	document.writeln('<input type="button" Value=". T o p ." onClick="scrollTo(0,0)">');
	document.writeln('</table>');
	document.writeln('<br>');
	if (cruft) {
		document.writeln( '</LAYER>' );
	} else {
		document.writeln( '</DIV>' );
	}
	document.writeln( '<br><br>' );
	if (cruft) {
		document.layers[0].document.speedy.ss.options[0].selectedIndex=3;
	} else {
	}
	if (aieee || cruft) {
		hold();
	}
	return true;
}

function getY(){
	if (cruft) {
		return top.pageYOffset;
	} else {
		return document.body.scrollTop;
	}
}

function holdwork(){
	if (cruft) {
		obj = document.floatScroll;
	} else {
		obj = document.getElementById("floatScroll").style;
	}
	obj.top = getY();
}

function hold(){
	holdwork();
	workInterval = setInterval( "holdwork()", 1000 );
}

