function startMegapod() {
	setTimeout("nextSlide(0)",5000);
}

function nextSlide(current) {
	next = 	current + 1;
	if (next == 6) next = 0;
	blendimage(current,next);
	setTimeout("nextSlide("+ next +")",5000);
}

var change;
function blendimage(current,next) {
	timer = 0;
	currentimage = image[current];
	nextimage = image[next];
    //set the current image as background
    document.getElementById("megapod").style.backgroundImage = "url(" + currentimage + ")";
    //make image transparent
    changeOpac(0,'promo-image');
    //make new image
    document.getElementById("promo-image").src = nextimage;
    //fade in image and text
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'promo-image')",(timer * 10));
        timer++;
    }
} 

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
    if (opacity == 50) changeText(next);
}
