var g_current = 0;
var g_divs = [];
var g_intervall = 5000;

function hideSubelements( div)
{
	
	for(var i = 0; i< div.childNodes.length; i++){
		var element = div.childNodes[i];
		
		if( element.tagName == "DIV"){
			
			g_divs.push(element);
			element.style.display = "none";	
		}
		
	}
}


function switchDiv(){
	
	g_divs[g_current].style.display = "none";
	g_current++;
	if( g_current == g_divs.length ){
		g_current = 0;
	}
	g_divs[g_current].style.display = "block";
	
	setTimeout(switchDiv, g_intervall);
	
	
}



function startAutoGallery()
{
	var gallery = document.getElementById("autoGallery");
	if( gallery ){	
		hideSubelements(gallery);
	}
	g_current = g_divs.length - 1;
	
	
	switchDiv();
	
}

