window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);
var doc=document, imgsb = new Array(), currentb=0;
function so_init() {
	if(!doc.getElementById || !doc.createElement)return;
	imgsb = doc.getElementById('fotosanima').getElementsByTagName("img");
	for(i=1;i<imgsb.length;i++) imgsb[i].xOpacity = 0;
	doc.getElementById('fotosanima').style.display='block';
	imgsb[0].style.display = "block";
	imgsb[0].xOpacity = .99;
	setTimeout(so_xfadeb,7000);
}

function so_xfadeb() {
	cOpacityb = imgsb[currentb].xOpacity;
	nIndexb = imgsb[currentb+1]?currentb+1:0;

	nOpacity = imgsb[nIndexb].xOpacity;
	
	cOpacityb-=.05; 
	nOpacity+=.05;
	
	imgsb[nIndexb].style.display = "block";
	imgsb[currentb].xOpacity = cOpacityb;
	imgsb[nIndexb].xOpacity = nOpacity;
	
	setOpacityb(imgsb[currentb]); 
	setOpacityb(imgsb[nIndexb]);
	
	if(cOpacityb<=0) {
		imgsb[currentb].style.display = "none";
		currentb = nIndexb;
		setTimeout(so_xfadeb,7000);
	} else {
		setTimeout(so_xfadeb,50);
	}
	
	function setOpacityb(objb) {
		if(objb.xOpacity>.99) {
			objb.xOpacity = .99;
			return;
		}
		objb.style.opacity = objb.xOpacity;
		objb.style.MozOpacity = objb.xOpacity;
		objb.style.filter = "alpha(opacity=" + (objb.xOpacity*100) + ")";
	}
	
}
