
var nrofbanners;
var headimgcounter;

function toprotate(timeout) {
	$($("div.headimg")[headimgcounter]).css({margin: "0px 0px 0px 0px"}).fadeIn("slow", function() {
			setTimeout (function () {
				$($("div.headimg")[headimgcounter]).fadeOut("slow");
				headimgcounter++;
				if (headimgcounter >= nrofbanners) headimgcounter = 0;
				toprotate(timeout);
			}, timeout);
	});
}

function initBio(timeout) {
	if ($("div#banner").children("div.headimg").size() == 0)
		return;
	timeout = timeout * 1000;
	nrofbanners = $("div#banner").children("div.headimg").size();
	headimgcounter = Math.floor(Math.random() * nrofbanners);

	$("div.headimg").each(function () {
		$(this).fadeOut ("fast");
	});
	toprotate(timeout);
}

