
window.addEventListener?window.addEventListener("load",so_init3,false):window.attachEvent("onload",so_init3);

var d=document, imgs3 = new Array(), zInterval = null, current3=0, pause=false;

var counterValue3 = 0;
var bahTwo3 = true;
function so_init3() {
	if(!d.getElementById || !d.createElement)return;
	
	imgs3 = d.getElementById("imageContainer").getElementsByTagName("img");
	for(i=1;i<imgs3.length;i++) imgs3[i].xOpacity3 = 0;
	imgs3[0].style.display = "block";
	imgs3[0].xOpacity3 = .99;
		
	checkHeights3(0);
}

function so_xfade3() {
	cOpacity3 = imgs3[current3].xOpacity3;
	nIndex3 = imgs3[current3+1]?current3+1:0;
	nOpacity3 = imgs3[nIndex3].xOpacity3;
	
	cOpacity3-=.02; 
	nOpacity3+=.02;
	
	imgs3[nIndex3].style.display = "block";
	imgs3[current3].xOpacity3 = cOpacity3;
	imgs3[nIndex3].xOpacity3 = nOpacity3;
	
	setOpacity3(imgs3[current3]); 
	setOpacity3(imgs3[nIndex3]);
			
	if(cOpacity3<=0) {
		
		imgs3[current3].style.display = "none";
		current3 = nIndex3;
		
		// check height of image and if falls outside of div then move up.
		x=new Image;
		x.src=imgs3[current3].src;
		
		iw=x.width;
		ih3=x.height;
		ix=imgs3[current3].style.top;
		iy=imgs3[current3].style.left;
		imgs3[previousImage3].style.top = "0px";
		checkHeights3(0);
		bahTwo3 = true;
		
	} else {
		setTimeout(so_xfade3,50);
	}
	
	function setOpacity3(obj) {
		if(obj.xOpacity3>.99) {
			obj.xOpacity3 = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity3;
		obj.style.MozOpacity = obj.xOpacity3;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity3*100) + ")";
	}
	
}

function checkHeights3(dodis3) {
	ih3 = imgs3[current3].height;
	if (ih3 > (315+20)) {
		ih3d = ih3 - 315;
	
		if (dodis3 < ih3d) {
			topStr3 = imgs3[current3].style.top;
			pxStart3 = topStr3.indexOf("px");
			topVal3 = topStr3.substring(0,pxStart3);
			imgs3[current3].style.top = (topVal3 - 1) + "px";
			dodis3 += 1;
			bahTwo3 = false;
			the_timeout3 = setTimeout("checkHeights3("+ dodis3 +");", 50);
		} else {
			bahTwo3 = true;
			setTimeout(so_xfade3,4000);
		}
	}
	else {
		setTimeout(so_xfade3,4000);
	}
	previousImage3 = current3;
}

