if( !window.startJSImageRotation )
{
	function startJSImageRotation( modid, delay, imglist, opacity, linkurl )
	{
		if( !window.JSImageRotationCurrentImage )
			window.JSImageRotationCurrentImage = new Array();
		if( window.JSImageRotationCurrentImage[modid] == undefined )
			window.JSImageRotationCurrentImage[modid] = 1;
		if( !window.JSImageRotationImages )
			window.JSImageRotationImages = new Array();
		if( imglist != null )
		{
			window.JSImageRotationImages[modid] = imglist;
		}

		imglist = window.JSImageRotationImages[modid];

		var img = document.getElementById( "JSImageRotation" + modid );
		var div = document.getElementById( "JSImageRotationBox" + modid );
//		var msg = document.getElementById( "outerframebottom" );
//		msg.innerHTML = linkurl + " opacity: " + opacity + "alpha: " + img.style.filter;

		if( opacity == 1 ) // A new fade is starting
		{
		}
		opacity = opacity - 0.04;
		if( opacity <= 0 ) // The fade is complete, long delay until next fade
		{
			img.src = imglist[window.JSImageRotationCurrentImage[modid]];

			window.JSImageRotationCurrentImage[modid]++;
			if( window.JSImageRotationCurrentImage[modid] >= imglist.length )
			{
				window.JSImageRotationCurrentImage[modid] = 0;
				if( linkurl.length > 0 && linkurl != undefined )
				{
//					setTimeout( "window.location = '" + linkurl + "'", delay );
					setTimeout( "pageFadeOut( 1, \"" + linkurl + "\" );", delay );
					return;
				}
			}
			div.style.background = "url( '" + imglist[window.JSImageRotationCurrentImage[modid]] + "' )";
			div.style.width = img.width + "px";
			div.style.height = img.height + "px";
			opacity = 1;
			setTimeout( "startJSImageRotation( \"" + modid + "\", \"" + delay + "\", null, " + opacity + ", \"" + linkurl + "\" )", delay );
		}
		else
		{
			setTimeout( "startJSImageRotation( \"" + modid + "\", \"" + delay + "\", null, " + opacity + ", \"" + linkurl + "\" )", 10 );
		}
		img.style.opacity = opacity;
		img.style.filter = "alpha(opacity=" + ( opacity * 100 ) + ")";
	}
}
