var automatic_offset = 0;
var automatic_interval = 6000;
var automatic_slide = setInterval (function () { switch_on_overlay (0, true) }, automatic_interval);

function switch_on_overlay (nr, automated) {

	switch (nr) {
	
		case 0:
		
			// Add 1
			automatic_offset++;
			
			// Check
			if (automatic_offset > 3)
				automatic_offset = 1;
				
			return switch_on_overlay (automatic_offset, true);
			
			break;
		
		case 1:
			
			// Clear if manual
			if (automated == false) {
				
				clearInterval(automatic_slide);
			}
		
			var item_on = "#item_1";
			var item_off_1 = "#item_2";
			var item_off_2 = "#item_3";
		
			var preview_on = "#preview_1";
			var preview_off_1 = "#preview_2";
			var preview_off_2 = "#preview_3";
			
			break;
			
		case 2:
			
			// Clear if manual
			if (automated == false) {
				
				clearInterval(automatic_slide);
			}
			
			var item_on = "#item_2";
			var item_off_1 = "#item_1";
			var item_off_2 = "#item_3";
		
			var preview_on = "#preview_2";
			var preview_off_1 = "#preview_1";
			var preview_off_2 = "#preview_3";			
		
			break;

		case 3:
			
			// Clear if manual
			if (automated == false) {
				
				clearInterval(automatic_slide);
			}
			
			var item_on = "#item_3";
			var item_off_1 = "#item_1";
			var item_off_2 = "#item_2";
		
			var preview_on = "#preview_3";
			var preview_off_1 = "#preview_1";
			var preview_off_2 = "#preview_2";			
		
			break;					
	}
	
	$(item_off_1+" .text").css("display", "none");
	$(item_off_1+" .picture").css("display", "block");

	$(item_off_2+" .text").css("display", "none");
	$(item_off_2+" .picture").css("display", "block");
	
	$(item_on+" .picture").css("display", "none");
	$(item_on+" .text").css("display", "block");
	
	$(preview_off_1).css("display", "none");
	$(preview_off_2).css("display", "none");
	$(preview_on).fadeIn("slow");
}