var currStoryIdx = 0;
var nStories = 0;
var paused = false;
var playing = false;
var mn_300x250 = null;

function pauseStories(force) {
	paused = true;
}
function playStories(force) {
	if (nStories == 0) return;

	if (force) {
		if (playing == true) return;

		paused = false;
		playing = true;
	} else if (paused) {
		playing = false;
		return;
	}

	incrStory(1);

	setTimeout('playStories(false)', 10000)
}
function incrStory(incrVal) {
	if (nStories == 0) return;

	currStoryIdx += incrVal;

	if (currStoryIdx > nStories) {
		currStoryIdx = 1;
	} else if (currStoryIdx < 1) {
		currStoryIdx = nStories;
	}

	showStory();
}
function showStory() {
	vizObj = document.getElementById('dl-' + currStoryIdx);

	if (vizObj != null) {
		for (i = 1; i <= nStories; i++) {
			divObj = document.getElementById('dl-' + i);
			if (divObj != null) {
				divObj.style.display = 'none';
			}
		}
		vizObj.style.display = 'block';
	}
}

function btnOvr(btn) {
	btn.className+=" over";
	btn.className=btn.className.replace(" clk", "");
}
function btnOut(btn) {
	btn.className=btn.className.replace(" over", "");
	btn.className=btn.className.replace(" clk", "");
}
function btnClk(btn) {
	btn.className+=" clk";
	btn.className=btn.className.replace(" over", "");
}

var initWin = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=initWin;

