var MyControlsfade = new Array("#1","#2","#3","#4","#5","#6","#7","#8","#9","#10","#11","#12","#13","#14","#15","#16");

var ImgTimer = 5000; 							
var ImgFadeSpeed = 1000; 

$(document).ready(function() {

	


if(MyControlsfade[0] == null)
	{ alert('array cannot be empty'); } 
else 
	{
		$(MyControlsfade[0]).show();
		
		for ( var i=0; i<=MyControlsfade.length-1; i++ ){
			if(i != 0) { $(MyControlsfade[i]).hide(); }
		}

		if(MyControlsfade.length-1 > 0 )
		{ setTimeout ( "FadeTwo(1)", ImgTimer ); }
	}

});

//Lets figure out the animation
function FadeTwo(arrayID)
{
	if(arrayID != 0)
	{
		$(MyControlsfade[arrayID-1]).fadeOut(ImgFadeSpeed, function() {												 
			$(MyControlsfade[arrayID]).fadeIn(ImgFadeSpeed);
		  });
	} 
	else 
	{
		$(MyControlsfade[MyControlsfade.length-1]).fadeOut(ImgFadeSpeed, function() {												
			$(MyControlsfade[arrayID]).fadeIn(ImgFadeSpeed);
		  });
	}
	
	if(arrayID+1 > MyControlsfade.length-1)
	{ setTimeout("FadeTwo(0)",ImgTimer); } 
	else 
	{
		var arrID = arrayID+1;
		setTimeout("FadeTwo("+arrID+")",ImgTimer);
	}
}
