var aSlideshows = new Array();
var iDelay = 5000;

function LoadAutoSlides(oItem,iIndex) {
	aSlideshows[iIndex] = oItem.childElements();
	
	if (aSlideshows[iIndex].length > 1) setTimeout('SwitchAutoSlide(' + iIndex + ',' + aSlideshows[iIndex].length + ',0,0)',iDelay);
}

function SwitchAutoSlide(iSlideshowIndex,iFramesTotal,iFrame,iIteration) {
	iIteration++;
	
	Effect.Fade($(aSlideshows[iSlideshowIndex][iFrame]),{duration:2.5});
	
	iFrame++;
	if (iFrame == iFramesTotal) iFrame = 0;
	
	Effect.Appear($(aSlideshows[iSlideshowIndex][iFrame]),{duration:2.5});
		
	setTimeout('SwitchAutoSlide(' + iSlideshowIndex + ',' + iFramesTotal + ',' + iFrame + ',' + iIteration + ');',iDelay);
}

function InitAutoSlideshow() {
	if($$('div.AutoSlide')) {
		$$('div.AutoSlide').each(function(item,index) {
			LoadAutoSlides(item,index);
		});
	}
}

womAdd('InitAutoSlideshow()');
