var img = new Image(); 

function waitFor(source){
var t;
img.src = source;
	
	if(!img.complete) {
		//imgWait=setTimeout('waitFor(img)', 250);
		t=setTimeout('document["img01"].src=img.src',2000);
		
	}
	else {
		alert('loading: '+source);
		document["img01"].src=img.src;
	} 	
}

function timedMsg()
{
var t=setTimeout("timedMsg()",2000);
alert('2 seconds!');
}