
if (window.addEventListener) {
	window.addEventListener("load", xf_init, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", xf_init);
}


var xf_images = new Array();
var xf_currentimage = 0;
var xf_container = "banner";

function xf_init () {
	xf_images = document.getElementById(xf_container).getElementsByTagName("img");

	for(i=1; i<xf_images.length; i++) {
		xf_images[i].xOpacity = 0;
	}
	xf_images[0].style.display = "block";
	xf_images[0].xOpacity = .99;
	
	setTimeout(xf_loop,30000);

}

function xf_loop() {
	cOpacity = xf_images[xf_currentimage].xOpacity;
	nIndex = xf_images[xf_currentimage+1]?xf_currentimage+1:0;

	nOpacity = xf_images[nIndex].xOpacity;
	
	cOpacity-=.01; 
	nOpacity+=.01;
	
	xf_images[nIndex].style.display = "block";
	xf_images[xf_currentimage].xOpacity = cOpacity;
	xf_images[nIndex].xOpacity = nOpacity;
	
	setOpacity(xf_images[xf_currentimage]); 
	setOpacity(xf_images[nIndex]);
	
	if(cOpacity<=0) {
		xf_images[xf_currentimage].style.display = "none";
		xf_currentimage = nIndex;
		setTimeout(xf_loop, 30000);
	} else {
		setTimeout(xf_loop, 10);
	}
	
	
	function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
	
}