$(document).ready(function() {
	var currImage = 0, oldImage = 0;
	
	var imageCount = $('#dayIcons li').length;
	

	var zIndex = 20;
	$('#dayIcons li').each(function() {
		$(this).css('z-index',zIndex);
		zIndex = zIndex-1;
	})
	

	
	var imageRotate = function() {
		
		currImage = (oldImage + 1) % imageCount;
		
	
		if (currImage === 0){
			
			$('#dayIcons li').eq(currImage).css('display','block').animate(
				{'opacity' : '1'}, 'normal', function() {

				pause = setTimeout(imageRotate, 2000);					
				$('#dayIcons li').css({'opacity':'100','display':'block'});	
			});
		}
		else {
			$('#dayIcons li').eq(oldImage).animate(
				{'opacity' : '0'}, 'normal', function() {
					$(this).css('display','none');
					pause = setTimeout(imageRotate, 2000);				

				}
			);	
			
			
		}
		
		oldImage = currImage;
		
	}
	
	setTimeout(imageRotate,2000);
	



	
//	$('#birth').datepicker('option', 'firstDay', 2);
	


	
	
	
});
