function gallery2() {
		
	var children = $('gallery2_container').getElementsByTagName('div');
	start = null;
	end = null;

	// find the first visible child and hide it.
	for (x = 0; x < children.length; x++){
		if ($(children[x]).visible()) {
			start = x;
			break;
		 }
	}
	
	//find the last visible child, add 1 and show it.
	for (x = (children.length - 1); x >= 0; x--){
		if ($(children[x]).visible()) {
			if (x == children.length-1) {
				break;
			}
			else if (x < children.length-1) {
				end = x + 1;
				break;
			}
		 }
	}
	
	if (end == null)
		end = 0;
	
	if (start != null & end != null) {
		Effect.Fade(children[start].id, {afterFinish: function(){
				Effect.Appear(children[end].id);
				x = children[start]; 
				Element.remove(children[start]);		//delete original
				$('gallery2_container').appendChild(x); //append to the end
		} });
	}
	
	setTimeout(gallery2,5000);
	
}

function gallery2_start() {
	setTimeout(gallery2,3000);
}

Event.observe(window, 'load', gallery2_start, false);
