// JavaScript Document

var undefined;



function LinkAlert(URL,target,type) {

	BankName = "Farmers Bank of Cook"
	MSG = new Array();
	MSG[0] = "You are now leaving the " + BankName + " web site. Neither " + BankName + " nor any of its subsidiaries or affiliates are responsible for the content of any external web site.";
	
	myTarget = "_blank";
	if (target!=undefined) myTarget = target;
	if (type!="" && type!=undefined) alert(MSG[type]);
	else if (confirm(MSG[0])) window.open(URL,myTarget);
	}

function LaunchCalc(URL) {
	window.open (URL,'myCalculator','width=580,height=450');
	}

function newWindow() {
	window.open("","launch","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=400");
	}


// This layer finds an object by ID and is cross-browser compliant.

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}


delay = 5000;
	var images = new Array();
	var pointer = 0; // Where we are in the rotation
	
	images.push(Array("images/photos/branch1-mini.jpg",''));
	images.push(Array("images/photos/branch2-mini.jpg",''));
	images.push(Array("images/photos/branch3-mini.jpg",''));
	images.push(Array("images/photos/branch4-mini.jpg",''));
	images.push(Array("images/photos/branch5-mini.jpg",''));
	images.push(Array("images/photos/branch6-mini.jpg",''));
	images.push(Array("images/photos/branch7-mini.jpg",''));
	images.push(Array("images/photos/branch8-mini.jpg",''));
	images.push(Array("images/photos/branch9-mini.jpg",''));
	
	var seed = images.length;
	
	//RandomImage();
	function RandomImage() 
		{ 
		core = Math.floor(Math.random()*seed)+1;
		document.img1.src = images[core];
		setTimeout('RandomImage()',delay);
		}
	
	function Rotate(pos) {
		document.splash.src = images[pos][0];
		pointer = pos;
		pos = pos + 1;
		if (pos>=seed) pos = 0;
		setTimeout('Rotate('+pos+');',delay);
		}
	
	function RotateLink() {
		if (images[pointer][1]!=null) HREF(images[pointer][1]);
		}

var fade_interval = 2;
var rotate_interval = 4000;
var img_pos = 0;

function init(pos) {
	pos++;
	img_pos++;
	if (pos==images.length) pos = 0;		
	if (img_pos==5) img_pos = 1;		
	// crossfade(elementbyid, new image url, new alt text);
	//core = Math.floor(Math.random()*4)+1;
	crossfade(document.getElementById('img'+img_pos), images[pos][0], fade_interval, images[pos][1]);
	next = window.setTimeout("init("+pos+");", rotate_interval);
	}