// HOMEPAGE ROLL OVER CODE
function show(id) {
	document.getElementById(id).style.visibility = "visible";
	document.getElementById(id).style.display = "block";
}
function hide(id) {
	document.getElementById(id).style.visibility = "hidden";
	document.getElementById(id).style.display = "none";
}
function showSection(strSection){
	show('gray_overlay');
	show(strSection+"_over");
}
function clearRollOver(strSection){
	hide('gray_overlay');
	hide(strSection+"_over");
}


// HOMEPAGE IMAGE ROTATOR CODE
var imgGrp0 = new Array("images/home/g1_e1.jpg","images/home/g1_e2.jpg","images/home/g1_e3.jpg");
var imgGrp1 = new Array("images/home/g2_e1.jpg","images/home/g2_e2.jpg","images/home/g2_e3.jpg");
var imgGrp2 = new Array("images/home/g3_e1.jpg","images/home/g3_e2.jpg","images/home/g3_e3.jpg");
var imgGrp3 = new Array("images/home/g4_e1.jpg","images/home/g4_e2.jpg","images/home/g4_e3.jpg");
var imgGrp4 = new Array("images/home/g5_e1.jpg","images/home/g5_e2.jpg","images/home/g5_e3.jpg");
var imgGrp5 = new Array("images/home/g6_e1.jpg","images/home/g6_e2.jpg","images/home/g6_e3.jpg");

var imgGrpQuote = new Array("images/home/quote_green_01.gif","images/home/quote_green_02.gif","images/home/quote_green_03.gif");

var aryImgList = new Array(imgGrp0, imgGrp1, imgGrp2, imgGrp3, imgGrp4, imgGrp5)

var aryCurImgIndexList = new Array(0, 0, 0, 0, 0, 0);

var quoteCycleCount=0;
var quoteIndex=0;

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

window.setInterval("cycleImages()",3000);

function cycleImages() {
	if (quoteCycleCount<3){
	  var intRand = rand(aryImgList.length)-1;
	  var intCurIndex = aryCurImgIndexList[intRand];
	  if (aryCurImgIndexList[intRand] == aryImgList[intRand].length-1)
	  {
		  aryCurImgIndexList[intRand] = 0;
	  }
	  else
	  {
		  aryCurImgIndexList[intRand]++;
	  }
	  var imgObj = document.getElementById('imgGrp'+intRand);
	  imgObj.src=aryImgList[intRand][aryCurImgIndexList[intRand]];
	  quoteCycleCount++;
	} else{
		quoteIndex++;
	  if (quoteIndex > imgGrpQuote.length-1)
	  {
		  quoteIndex=0;
	  }
	  var imgObj = document.getElementById('imgGrpQuote');
	  imgObj.src=imgGrpQuote[quoteIndex];
	  quoteCycleCount=0;
	}
}

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
	var result = Math.ceil(rnd()*number);
	if (!result)result++;
        return result

};

function getRandomImage(intImgGroup){
	var intRand = rand(aryImgList[intImgGroup].length)-1;
	aryCurImgIndexList[intImgGroup] = intRand;
	return aryImgList[intImgGroup][intRand];
}

