var animTimer,imgCount,currAlpha,currImage;
imgCount = 5;
currAlpha = 100;
currImage = 1;
var fadeRate = 50;
var stepRate = 3000;

function fadeOut() {
	clearTimeout(animTimer);
	var thisObj = document.getElementById("banner-wrapper-"+currImage);
	currAlpha -= 10;
	if (currAlpha>=0) {
		thisObj.style.opacity = currAlpha/100;
		thisObj.style.filter = "alpha(opacity=" + currAlpha + ")";
		animTimer = setTimeout("fadeOut()",fadeRate);
	} else {
		currAlpha = 100;
		currImage++;
		if (currImage<imgCount) {
			animTimer = setTimeout("fadeOut()",stepRate);
		} else {
			currImage = 1;
			currAlpha = 0;
			animTimer = setTimeout("fadeIn()",stepRate);
		}
	}
}

function fadeIn() {
	clearTimeout(animTimer);
	var thisObj = document.getElementById("banner-wrapper-1");
	currAlpha += 10;
	if (currAlpha<=100) {
		thisObj.style.opacity = currAlpha/100;
		thisObj.style.filter = "alpha(opacity=" + currAlpha + ")";
		animTimer = setTimeout("fadeIn()",fadeRate);
	} else {
		for (var w=2;w<=imgCount;w++) {
			var fadeObj = document.getElementById("banner-wrapper-"+w);
			fadeObj.style.opacity = "1.0";
			fadeObj.style.filter = "alpha(opacity=100)";
		}
		animTimer = setTimeout("fadeOut()",stepRate);
	}
}

function animateIt() {
	clearTimeout(animTimer);
	//alert(document.getElementById("PC3119_menuMS"));
	//document.getElementById("PC3119_menuMS").style.backgroundColor = "rgb(0,255,0)";
	animTimer = setTimeout("fadeOut()",stepRate);
}

window.onLoad = animateIt();
