addLoadEvent(function()
{
	/* start looping */
	window.setTimeout(function(){ switchPortfolioImage(0); }, 3000);
});

function switchPortfolioImage(itemIndex)
{
	var items = getElementsByTagAndClassName("LI", null, $("portfolio"));
	if (items.length > 1)
	{
		/* fade out image i */
		fade(items[itemIndex], { "duration": 1 });

		/* get next image */
		itemIndex++;
		if (itemIndex >= items.length) itemIndex = 0;

		/* show next image */
		appear(items[itemIndex], { "duration": 1, "delay": 1 });

		/* loop */
		window.setTimeout(function(){ switchPortfolioImage(itemIndex); }, 3000 + 2000);
	}
}
