/*****

Image Cross Fade Redux
Version 1.0
Last revision: 02.15.2006
steve@slayeroffice.com

Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html


*****/

window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);
window.addEventListener?window.addEventListener("load",so_init2,false):window.attachEvent("onload",so_init2);
window.addEventListener?window.addEventListener("load",so_init3,false):window.attachEvent("onload",so_init3);
window.addEventListener?window.addEventListener("load",so_init4,false):window.attachEvent("onload",so_init4);
window.addEventListener?window.addEventListener("load",so_init5,false):window.attachEvent("onload",so_init5);
window.addEventListener?window.addEventListener("load",so_init6,false):window.attachEvent("onload",so_init6);
window.addEventListener?window.addEventListener("load",so_init7,false):window.attachEvent("onload",so_init7);
window.addEventListener?window.addEventListener("load",so_init8,false):window.attachEvent("onload",so_init8);
window.addEventListener?window.addEventListener("load",so_init9,false):window.attachEvent("onload",so_init9);
window.addEventListener?window.addEventListener("load",so_init10,false):window.attachEvent("onload",so_init10);

var d=document, imgs = new Array(), imgs2 = new Array(), imgs3= new Array(), imgs4= new Array(), imgs5= new Array(), imgs6= new Array(), imgs7= new Array(), imgs8= new Array(), imgs9= new Array(), imgs10= new Array(), zInterval = null, current1=0, current2=0, current3=0, current4=0, current5=0, current6=0, current7=0, current8=0, current9=0, current10=0, pause=false;

function so_init() {
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement("link");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs = d.getElementById("imageleft1").getElementsByTagName("img");
	
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;
	
	setTimeout(so_xfade,500);
}

function so_xfade() {
	cOpacity = imgs[current1].xOpacity;
	nIndex = imgs[current1+1]?current1+1:0;
	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;
	
	imgs[nIndex].style.display = "block";
	imgs[current1].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	setOpacity(imgs[current1]); 
	setOpacity(imgs[nIndex]);
	
	if(cOpacity<=0) {
		imgs[current1].style.display = "none";
		current1 = nIndex;
		setTimeout(so_xfade,2000);
	} else {
		setTimeout(so_xfade,50);
	}
	
	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) + ")";
	}
	
}

function so_init2() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link2");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs2 = d.getElementById("imageleft2").getElementsByTagName("img");
	
	for(i=1;i<imgs2.length;i++) imgs2[i].xOpacity = 0;
	imgs2[0].style.display = "block";
	imgs2[0].xOpacity = .99;
	
	setTimeout(so_xfade2,500);
}

function so_xfade2() {
	cOpacity2 = imgs2[current2].xOpacity;
	nIndex2 = imgs2[current2+1]?current2+1:0;
	nOpacity2 = imgs2[nIndex2].xOpacity;
	
	cOpacity2-=.05; 
	nOpacity2+=.05;
	
	imgs2[nIndex2].style.display = "block";
	imgs2[current2].xOpacity = cOpacity2;
	imgs2[nIndex2].xOpacity = nOpacity2;
	
	setOpacity2(imgs2[current2]); 
	setOpacity2(imgs2[nIndex2]);
	
	if(cOpacity2<=0) {
		imgs2[current2].style.display = "none";
		current2 = nIndex2;
		setTimeout(so_xfade2,2000);
	} else {
		setTimeout(so_xfade2,50);
	}
	
	function setOpacity2(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) + ")";
	}
	
}


function so_init3() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link3");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs3 = d.getElementById("imageleft3").getElementsByTagName("img");
	
	for(i=1;i<imgs3.length;i++) imgs3[i].xOpacity = 0;
	imgs3[0].style.display = "block";
	imgs3[0].xOpacity = .99;
	
	setTimeout(so_xfade3,500);
}

function so_xfade3() {
	cOpacity3 = imgs3[current3].xOpacity;
	nIndex3 = imgs3[current3+1]?current3+1:0;
	nOpacity3 = imgs3[nIndex3].xOpacity;
	
	cOpacity3-=.05; 
	nOpacity3+=.05;
	
	imgs3[nIndex3].style.display = "block";
	imgs3[current3].xOpacity = cOpacity3;
	imgs3[nIndex3].xOpacity = nOpacity3;
	
	setOpacity3(imgs3[current3]); 
	setOpacity3(imgs3[nIndex3]);
	
	if(cOpacity3<=0) {
		imgs3[current3].style.display = "none";
		current3 = nIndex3;
		setTimeout(so_xfade3,2000);
	} else {
		setTimeout(so_xfade3,50);
	}
	
	function setOpacity3(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) + ")";
	}
	
}
function so_init4() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link4");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs4 = d.getElementById("imageleft4").getElementsByTagName("img");
	
	for(i=1;i<imgs4.length;i++) imgs4[i].xOpacity = 0;
	imgs4[0].style.display = "block";
	imgs4[0].xOpacity = .99;
	
	setTimeout(so_xfade4,500);
}

function so_xfade4() {
	cOpacity4 = imgs3[current4].xOpacity;
	nIndex4 = imgs3[current4+1]?current4+1:0;
	nOpacity4 = imgs3[nIndex4].xOpacity;
	
	cOpacity4-=.05; 
	nOpacity4+=.05;
	
	imgs4[nIndex4].style.display = "block";
	imgs4[current4].xOpacity = cOpacity4;
	imgs4[nIndex4].xOpacity = nOpacity4;
	
	setOpacity4(imgs4[current4]); 
	setOpacity4(imgs4[nIndex4]);
	
	if(cOpacity4<=0) {
		imgs4[current4].style.display = "none";
		current4 = nIndex4;
		setTimeout(so_xfade4,2000);
	} else {
		setTimeout(so_xfade4,50);
	}
	
	function setOpacity4(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) + ")";
	}
	
}

function so_init5() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link5");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs5 = d.getElementById("imageleft5").getElementsByTagName("img");
	
	for(i=1;i<imgs5.length;i++) imgs5[i].xOpacity = 0;
	imgs5[0].style.display = "block";
	imgs5[0].xOpacity = .99;
	
	setTimeout(so_xfade5,500);
}

function so_xfade5() {
	cOpacity5 = imgs5[current5].xOpacity;
	nIndex5 = imgs5[current5+1]?current5+1:0;
	nOpacity5 = imgs5[nIndex5].xOpacity;
	
	cOpacity5-=.05; 
	nOpacity5+=.05;
	
	imgs5[nIndex5].style.display = "block";
	imgs5[current5].xOpacity = cOpacity5;
	imgs5[nIndex5].xOpacity = nOpacity5;
	
	setOpacity5(imgs5[current5]); 
	setOpacity5(imgs5[nIndex5]);
	
	if(cOpacity5<=0) {
		imgs5[current5].style.display = "none";
		current5 = nIndex5;
		setTimeout(so_xfade5,2000);
	} else {
		setTimeout(so_xfade5,50);
	}
	
	function setOpacity5(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) + ")";
	}
	
}

function so_init6() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link6");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs6 = d.getElementById("imageleft6").getElementsByTagName("img");
	
	for(i=1;i<imgs6.length;i++) imgs6[i].xOpacity = 0;
	imgs6[0].style.display = "block";
	imgs6[0].xOpacity = .99;
	
	setTimeout(so_xfade6,500);
}

function so_xfade6() {
	cOpacity6 = imgs6[current6].xOpacity;
	nIndex6 = imgs6[current6+1]?current6+1:0;
	nOpacity6 = imgs6[nIndex6].xOpacity;
	
	cOpacity6-=.05; 
	nOpacity6+=.05;
	
	imgs6[nIndex6].style.display = "block";
	imgs6[current6].xOpacity = cOpacity6;
	imgs6[nIndex6].xOpacity = nOpacity6;
	
	setOpacity6(imgs6[current6]); 
	setOpacity6(imgs6[nIndex6]);
	
	if(cOpacity6<=0) {
		imgs6[current6].style.display = "none";
		current6 = nIndex6;
		setTimeout(so_xfade6,6000);
	} else {
		setTimeout(so_xfade6,50);
	}
	
	function setOpacity6(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) + ")";
	}
	
}

function so_init7() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link7");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs7 = d.getElementById("imageleft7").getElementsByTagName("img");
	
	for(i=1;i<imgs7.length;i++) imgs7[i].xOpacity = 0;
	imgs7[0].style.display = "block";
	imgs7[0].xOpacity = .99;
	
	setTimeout(so_xfade7,500);
}

function so_xfade7() {
	cOpacity7 = imgs7[current7].xOpacity;
	nIndex7 = imgs7[current7+1]?current7+1:0;
	nOpacity7 = imgs7[nIndex7].xOpacity;
	
	cOpacity7-=.05; 
	nOpacity7+=.05;
	
	imgs7[nIndex7].style.display = "block";
	imgs7[current7].xOpacity = cOpacity7;
	imgs7[nIndex7].xOpacity = nOpacity7;
	
	setOpacity7(imgs7[current7]); 
	setOpacity7(imgs7[nIndex7]);
	
	if(cOpacity7<=0) {
		imgs7[current7].style.display = "none";
		current7 = nIndex7;
		setTimeout(so_xfade7,7000);
	} else {
		setTimeout(so_xfade7,50);
	}
	
	function setOpacity7(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) + ")";
	}
	
}

function so_init8() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link8");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs8 = d.getElementById("imageleft8").getElementsByTagName("img");
	
	for(i=1;i<imgs8.length;i++) imgs8[i].xOpacity = 0;
	imgs8[0].style.display = "block";
	imgs8[0].xOpacity = .99;
	
	setTimeout(so_xfade8,500);
}

function so_xfade8() {
	cOpacity8 = imgs8[current8].xOpacity;
	nIndex8 = imgs8[current8+1]?current8+1:0;
	nOpacity8 = imgs8[nIndex8].xOpacity;
	
	cOpacity8-=.05; 
	nOpacity8+=.05;
	
	imgs8[nIndex8].style.display = "block";
	imgs8[current8].xOpacity = cOpacity8;
	imgs8[nIndex8].xOpacity = nOpacity8;
	
	setOpacity8(imgs8[current8]); 
	setOpacity8(imgs8[nIndex8]);
	
	if(cOpacity8<=0) {
		imgs8[current8].style.display = "none";
		current8 = nIndex8;
		setTimeout(so_xfade8,8000);
	} else {
		setTimeout(so_xfade8,50);
	}
	
	function setOpacity8(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) + ")";
	}
	
}

function so_init9() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link9");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs9 = d.getElementById("imageleft9").getElementsByTagName("img");
	
	for(i=1;i<imgs9.length;i++) imgs9[i].xOpacity = 0;
	imgs9[0].style.display = "block";
	imgs9[0].xOpacity = .99;
	
	setTimeout(so_xfade9,500);
}

function so_xfade9() {
	cOpacity9 = imgs9[current9].xOpacity;
	nIndex9 = imgs9[current9+1]?current9+1:0;
	nOpacity9 = imgs9[nIndex9].xOpacity;
	
	cOpacity9-=.05; 
	nOpacity9+=.05;
	
	imgs9[nIndex9].style.display = "block";
	imgs9[current9].xOpacity = cOpacity9;
	imgs9[nIndex9].xOpacity = nOpacity9;
	
	setOpacity9(imgs9[current9]); 
	setOpacity9(imgs9[nIndex9]);
	
	if(cOpacity9<=0) {
		imgs9[current9].style.display = "none";
		current9 = nIndex9;
		setTimeout(so_xfade9,9000);
	} else {
		setTimeout(so_xfade9,50);
	}
	
	function setOpacity9(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) + ")";
	}
	
}

function so_init10() {
	if(!d.getElementById || !d.createElement)return;
	
	css = d.createElement("link10");
	css.setAttribute("href","scripts/xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	imgs10 = d.getElementById("imageleft10").getElementsByTagName("img");
	
	for(i=1;i<imgs10.length;i++) imgs10[i].xOpacity = 0;
	imgs10[0].style.display = "block";
	imgs10[0].xOpacity = .99;
	
	setTimeout(so_xfade10,500);
}

function so_xfade10() {
	cOpacity10 = imgs10[current10].xOpacity;
	nIndex10 = imgs10[current10+1]?current10+1:0;
	nOpacity10 = imgs10[nIndex10].xOpacity;
	
	cOpacity10-=.05; 
	nOpacity10+=.05;
	
	imgs10[nIndex10].style.display = "block";
	imgs10[current10].xOpacity = cOpacity10;
	imgs10[nIndex10].xOpacity = nOpacity10;
	
	setOpacity10(imgs10[current10]); 
	setOpacity10(imgs10[nIndex10]);
	
	if(cOpacity10<=0) {
		imgs10[current10].style.display = "none";
		current10 = nIndex10;
		setTimeout(so_xfade10,2000);
	} else {
		setTimeout(so_xfade10,50);
	}
	
	function setOpacity10(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) + ")";
	}
	
}