$(function() {
	var imghtml = "";
	$(".photorotate a").each(function() {
		imghtml += '<img src="'+$(this).attr('href')+'" width="300" height="200" alt="'+$(this).html()+'" />';
	});
	if (imghtml) {
		$(".photorotate").append(imghtml).find("img:gt(0)").hide();
		setTimeout(function() { imgrotate(0) }, 5000);
	}
});

function imgrotate(curimg) {
	$(".photorotate img:eq("+curimg+")").fadeOut("slow");
	curimg++;
	if (curimg >= $(".photorotate img").length || curimg < 0) {
		curimg = 0;
	}
	$(".photorotate img:eq("+curimg+")").fadeIn("slow");
	setTimeout(function() { imgrotate(curimg) }, 5000);
}