setTimeout doesn't seem to be calling the function... help please?
===

The code worked great until I added the setTimeout. Now, no matter how I attempt to call the functions in setTimeout (setTimeout(function(){fadeOut()},1000); setTimeout("fadeOut()",1000); etc) it doesn't seem to get to the function at all.

I'm a Javascript newbie so any and all help is appreciated =]


javascript code:

var slideArray = ["slide1","slide2","slide3","slide4","slide5","slide6"];

var currentSlide = null;

var current = null;

var done = false;


function fade(newSlide)

{

	if(currentSlide === null)

	{

		currentSlide = slideArray[0];

		document.getElementById(currentSlide).style.opacity = 1.0;

		for(var i=1;i<slideArray.length;i++)

			document.getElementById(slideArray[i]).style.opacity = 0.0;

	}

	current = document.getElementById(currentSlide);

	done = false;

	do

	{

		window.setTimeout(fadeOut,1000);

	} while(done == false);

	currentSlide = newSlide;

	current = document.getElementById(currentSlide);

	done = false;

	do

	{

		window.setTimeout(fadeIn,1000);

	} while(done == false);

}

function fadeOut()

{

	if(parseFloat(current.style.opacity)-0.1>.0000001)

	{

		current.style.opacity = parseFloat(current.style.opacity) -0.1;

		done = false;

	}

	else

	{

		current.style.opacity = 0.0;

		done = true;

	}

}

function fadeIn()

{

	if(0.9-parseFloat(current.style.opacity)>.0000001)

	{

		current.style.opacity = parseFloat(current.style.opacity)+0.1;

		done = false;

	}

	else

	{

		current.style.opacity = 1.0;

		done = true;

	}

}
