
window.addEvent('domready', function(){

	var members = $$('.moo_fade_simple p') ;
	var functional_prefix = "moo_fade_simple_" ;
	var visible_opacity = 0.999999 ;
	var invisible_opacity = 0.0001 ;
	var display_length = 5000 ;
	var fade_length = 500 ;
	var current_tab = 1 ;

	members.setStyles({'opacity':invisible_opacity}) ;
	members[0].morph({'opacity':visible_opacity}) ;
	members[1].morph({'opacity':visible_opacity}) ;

	var myFunction = function(){
		// add 1 to the current tab and reset if total count.
		current_tab = current_tab + 1 ;
		if(current_tab==members.length){
			current_tab = 0 ;
			prev_tab = members.length-1 ;
		} else {
			prev_tab = current_tab - 1 ;
		}
		// count thru each, setting all zindexes low except current and previous
		count_keeper = 0 ;
		members.set('morph', {duration: fade_length}); 
		members.each(function(fade_member){
			if(count_keeper==current_tab){
				fade_member.morph({'opacity':invisible_opacity}) ;
			} else if(count_keeper==prev_tab){
				fade_member.morph({'opacity':visible_opacity}) ;
			} else {
				fade_member.morph({'opacity':invisible_opacity}) ;
			}
			count_keeper++ ;
		});
		members[current_tab].morph({'opacity':visible_opacity}) ;
		myFunction.delay(display_length+fade_length)
	};
	myFunction.delay(display_length+fade_length);

});
