
function callbackRotationEffect(effect){
	var rand = Math.floor(Math.random()*(imagePath.length+1));
	$('headerImage').style.backgroundImage = 'url(' + imagePath[rand] + ')';
	startImageAnimation();
}

function startImageAnimation(){
	$('headerImage').style.display="none";
	new Effect.Appear($('headerImage'), {duration: 1, from: 0.01, to:  1});
	new Effect.Fade($('headerImage'), {queue:'end', from: 1, to: 0.01, delay:4, duration: 1, afterFinish: callbackRotationEffect});
}

if (window.attachEvent) {
	window.attachEvent("onload", startImageAnimation);
} else {
	window.addEventListener("load", startImageAnimation, false);
}

