/*
--------------------------------------------------

MachineryLink
scroller.js

Joe Morrow [joe.morrow@acquitygroup.com]
10/03/2008

Copyright © 2008 Acquity Group LLC

--------------------------------------------------
*/



window.onload = initRotate2;
var containerID, stor, maxstor, lastShownStor;


function initRotate2() {
	containerID = (containerID == null) ? "scrollContainer" : containerID;

	if (document.getElementById(containerID) != null) {

		// set menu defaults
		stor = -1;
		lastShowStor = stor;
		maxstor = document.getElementById(containerID).getElementsByTagName("li").length - 1;

		// preset the first state
		showNext2();
	}
}

function rotateDiv2(stor) {
	var divs = document.getElementById(containerID).getElementsByTagName("li");
	for (var i=0; i<divs.length; i++) {
		var div = divs[i];
		div.style.display = ((i != stor) && (i != stor + 1))  ? "none" : "block";
	}
}

function showNext2() {
	lastShownStor = stor;
	stor = (stor < maxstor - 1) ? stor + 1 : stor;
	rotateDiv2(stor);
}

function showPrev2() {
	lastShownStor = stor;
	stor = (stor > 0) ? stor - 1 : stor;
	rotateDiv2(stor);
}
