// JavaScript Document
var images = new Array();
images[0] = "helpingyou";
images[1] = "financialworkbench";
images[2] = "finenhancement";
images[3] = "insurancesurvey";

var imageCounter = 0;
var timer = 9000;

function animation() {
	
	/*
	for (i=0; i<images.length; i++) {
		var image = images[i];
		imageAppear(image);
		setTimeout('imageFade(' + image + ')', 6000);
	}
	*/
	
	var elementId = images[imageCounter];
	
	
	
	
	imageAppear(elementId);
	setTimeout('imageFade("' + elementId + '")', timer - 2000);
	
	/*
	if (imageCounter > images.length - 1) {
		imageCounter = 0;
	} else {
		imageCounter++;
	}
	*/
	
	if (imageCounter < images.length - 1) {
	
		imageCounter++;
	} else {
		imageCounter = 0;
	}
	
	setTimeout("animation()", timer);
	
}

function imageAppear(id) {
	
	var anElement = document.getElementById(id);

	anElement.appear({ duration: 2.0 });
	
	//$(id).appear({ duration: 2.0 });
		
	//Effect.Appear('helpingyou', { duration: 2.0 });
	
	
}

function imageFade(id) {

	var anElement = document.getElementById(id);
	
	anElement.fade({ duration: 2.0 });
	//$(id).fade({ duration: 2.0 });
	
	//Effect.Fade('helpingyou', { duration: 2.0 });
}


