tfx_slideshow = new Object();

tfx_slideshow.init = function(id, tag)
{
	tfx_slideshow.artwork = null;
	tfx_slideshow.counter = 0;
	tfx_slideshow.element = tfx_utility.find(id);
	
	if (tfx_slideshow.element)
	{
		tfx_slideshow.artwork = tfx_slideshow.element.getElementsByTagName(tag ? tag : "img");
		tfx_slideshow.timer = setTimeout("tfx_slideshow.swap()", 8000);
		
		for (var i = 1; i < tfx_slideshow.artwork.length; i++)
		{
			tfx_slideshow.artwork[i].style.filter = "alpha(opacity=0)";
			tfx_slideshow.artwork[i].style.opacity = 0;
		}
	}
}

tfx_slideshow.swap = function()
{
	var nextIndex = (tfx_slideshow.counter + 1) % tfx_slideshow.artwork.length;
	var next = tfx_slideshow.artwork[nextIndex];
	var prev = tfx_slideshow.artwork[tfx_slideshow.counter % tfx_slideshow.artwork.length];

	if (next && prev)
	{
		next.parentNode.href = next.title;
		
		new tfx_fade(next, 0.00, 1.00, 1);
		new tfx_fade(prev, 1.00, 0.00, 1);
	}
	
	tfx_slideshow.counter++;
	tfx_slideshow.timer = setTimeout("tfx_slideshow.swap()", 8000);
}
