var images = document.getElementById('slideShow').getElementsByTagName('img');

var duration = 2000;
var steps = 40;
var opacity = 0;
function crossFade() {
	if(opacity >= 1) {
		opacity = 0;
		images[curr].style.opacity = 1;
		images[curr].style.filter = "alpha(opacity=100)";
		images[prev].style.opacity = 0;
		images[prev].style.filter = "alpha(opacity=0)";
	} else {
		opacity += 1 / steps;
		images[curr].style.opacity = opacity;
		images[curr].style.filter = "alpha(opacity=" + opacity * 100 + ")";
		images[prev].style.opacity = 1 - opacity;
		images[prev].style.filter = "alpha(opacity=" + 100 - (opacity * 100) + ")";
		setTimeout('crossFade()', duration / steps);
	}
}

var curr = 0;
var prev = images.length - 1;
function runSlideShow() {
	if(0 == images.length) { return; }
	prev = curr;
	curr = (curr + 1) % images.length;
	crossFade();
	//if(('images/home/6.jpg' == images[curr].attributes['src'].value) || ('images/home/14.jpg' == images[curr].attributes['src'].value)) {
	if((8 == curr) || (23 == curr)) {
		setTimeout('runSlideShow()', 5000 + duration);
	} else {
		setTimeout('runSlideShow()', 2500 + duration);
	}
}
window.onload = function() { setTimeout('runSlideShow()', 3000) };

