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("cover_3").getElementsByTagName("img");
	for(i=1;i<imgs3.length;i++) imgs3[i].xOpacity3 = 0;
	imgs3[0].style.display = "block";
	imgs3[0].xOpacity3 = .99;
		
	checkHeights3(0);
	
	//setTimeout(so_xfade3,4000);
}

function so_xfade3() {
	cOpacity3 = imgs3[current3].xOpacity3;
	nIndex3 = imgs3[current3+1]?current3+1:0;
	nOpacity3 = imgs3[nIndex3].xOpacity3;
	
	cOpacity3-=.05; 
	nOpacity3+=.05;
	
	imgs3[nIndex3].style.display = "block";
	imgs3[current3].xOpacity3 = cOpacity3;
	imgs3[nIndex3].xOpacity3 = nOpacity3;
	
	setOpacity3(imgs3[current3]); 
	setOpacity3(imgs3[nIndex3]);
	//alert(bahTwo3);
	//alert(bahTwo3);
			
	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;
		//setTimeout(so_xfade3,4000);
		imgs3[previousImage3].style.top = "0px";
		checkHeights3(0);
		bahTwo3 = true;
		
	} else {
			setTimeout(so_xfade3,50);
			//checkHeights3(0);
	}
	
	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;
	
	//alert (current3);
	//if (current3 != 0) {
	//	previous = current3 - 1;
	//	imgs3[previous].style.top = "0px";
	//} 
	if (ih3 > (107+20)) {
		ih3d = ih3 - 107;
	
		//alert(ih3d + ' ' + dodis3);
		if (dodis3 < ih3d) {
			topStr3 = imgs3[current3].style.top;
			pxStart3 = topStr3.indexOf("px");
			topVal3 = topStr3.substring(0,pxStart3);
			//alert(topStr3.substring(0,pxStart3))
			imgs3[current3].style.top = (topVal3 - 1) + "px";
			dodis3 += 1;
			bahTwo3 = false;
			the_timeout3 = setTimeout("checkHeights3("+ dodis3 +");", 50);
		} else {
			bahTwo3 = true;
			//alert("finished panning");
			//alert(current3);
			setTimeout(so_xfade3,4000);
			//checkHeights3(0);
		}
	}
	else {
		setTimeout(so_xfade3,4000);
	}
	previousImage3 = current3;
}

