$(document).ready(function(){
	if('#animation'){
		var currentIndex = 0;
		var childIndex = 0;
		var total = $('#animation li').length;
	
		var animations = $('#animation li');
		var animations_children = $('#animation li').children();
	
		function animateChild(parent,callback){                         
			if(childIndex < 4){
				$(parent.children()[childIndex]).animate({opacity:'show'},1500,function(){
					childIndex++;
					animateChild(parent,callback);            
				});                  
			}else{
				childIndex = 0;        
				parent.children().animate({opacity:'hide'},1000);
				if(callback)callback();           
			}    
		}
	
		function animation(){
			if(currentIndex < total){ 
				animateChild($(animations[currentIndex]),function(){
				    currentIndex++; 
				    setTimeout(animation,1000);
				});                     
			}
			else{
				currentIndex = 0;
				animation();
			}
	
		}
		animation();
	}


});
