var animation = {
	speed: 0.8,
	duration: 4,
	imgList: "",
	frames: 0,
	lastframe: 0,
	nextFrame: function() {
		if(animation.lastframe < animation.frames -1) {
			// show news frame:
			animation.imgList.childElements()[animation.lastframe + 1].appear({duration: animation.speed});
			animation.lastframe ++; 
		} else {
			// hide all frames except first and last one:
			animation.imgList.childElements().each(function(item, index) {
															if(index > 0) {
																if(index < animation.frames -1) {
																	item.hide();
																	} else {
																	item.fade({duration: animation.speed});
																	}
															}
															})
			animation.lastframe = 0;
		}
		},
		init: function(speed, duration) {
			// find list:
			animation.imgList = $$('#box2 > ul')[0];
			animation.frames = animation.imgList.childElements().length;
			
			if(speed) {
				animation.speed = speed;
			}
			
			if(duration) {
				animation.duration = duration;
			}
			
			setInterval(animation.nextFrame, animation.duration * 1000);
		}
	};

