﻿<!--
//Sorry, This site requires JavaScript.

///////////////////////////////////////////////////
//                                               //
//       Script Customized by HostIowa.net       //
//   All Rights Reserved. May Not Be Reproduced  //
//                                               //
///////////////////////////////////////////////////


var curcontentindex=0;
var rotateTimer;
var messages=new Array();
var totalMessages;
var oper=1;
var loopCount=0;
var e;


function getElementByClass(classname) {
	var inc=0;
	
	var alltags=document.all? document.all : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++){
		if (alltags[i].className=="messagecontent")
		{
			messages[inc++]=alltags[i];
		}
	}
	totalMessages = messages.length-1;
}

function rotatecontent() {
	prevcontentindex = curcontentindex;
	curcontentindex=(curcontentindex<messages.length && curcontentindex>=0)? curcontentindex+oper : 0;
	if (curcontentindex == "-1") {
		prevcontentindex = 0;
		curcontentindex = totalMessages;
	} else if (curcontentindex == totalMessages + 1) {
		prevcontentindex = totalMessages;
		curcontentindex = 0;
	}

	messages[prevcontentindex].style.display="none"; //hide previous message
	messages[curcontentindex].style.display="block"; //show current message 

	//Set Styles
	var previousDiv = "thumb-" + (prevcontentindex+1);
	e = document.getElementById("thumb-current");
	e.className = "imgOp";
	e.id = previousDiv;

	var currentDiv = "thumb-" + (curcontentindex+1);
	e = document.getElementById(currentDiv);
	e.className = "imgOpCurrent";
	e.id = "thumb-current";

	loopCount++;
}

function nextcontent() {
	pausecontent();
	oper = 1;
	rotatecontent();
}

function previouscontent() {
	pausecontent();
	oper = -1;
	rotatecontent();
}

function pausecontent() {
	clearInterval(rotateTimer);
	setTimer();
}

function thisShowContent(index) {      
        for (i=0; i<messages.length; i++)
	{
                if(i == index)
		{
			messages[i].style.display="block";
                        var previousDiv = "thumb-" + (curcontentindex+1);
                        e = document.getElementById('thumb-current');
                        curcontentindex=i; // set this index to be the new current index
                        e.className = "imgOp";
                        e.id = previousDiv;
                        
                        var divId = "thumb-" + (i+1);
                        e = document.getElementById(divId);
                        e.className = "imgOpCurrent";
                        e.id = "thumb-current";
		}	
		else
		{
			messages[i].style.display="none";
		}
	}
	pausecontent();
}

function setTimer() {
	rotateTimer = setInterval("rotatecontent()", 6000);
}

function initContent() {
	e = document.getElementById("thumb-current")
	if (e) {
		e.className = "imgOpCurrent";
		getElementByClass();
            	setTimer();
	}
}

// end generated JavaScript. -->
