var imgnodes = [];
var id;
var zindex = 0;
function start(element){
	if (document.getElementById(element)) {
		id = element;
		var e = document.getElementById(id);
		
		/* get image nodes */
		for (var node in e.childNodes) {
			if (e.childNodes[node].tagName == 'IMG') {
				imgnodes.push(node)
			}
		}
		showpicture(0);
	}
}

function setOpacity(id, alpha) {
	var element = document.getElementById(id);
	var style = element.style;
	if( style.MozOpacity != undefined ) { //Moz and older
		style.MozOpacity = alpha;
	}
	else if( style.filter != undefined ) { //IE
		style.filter = "alpha(opacity=0)";
		element.filters.alpha.opacity = ( alpha * 100 );
	}
	else if( style.opacity != undefined ) { //Opera
		style.opacity = alpha;
	}
}

function setTitle(text) {
	/*
	document.getElementById(id + '_title_text').innerHTML = text;
	document.getElementById(id + '_title').style.zIndex = zindex+10;
	*/
}

function showpicture(num){
	zindex++;
	var e = document.getElementById(id).childNodes[imgnodes[num]];
	
	setOpacity(e.id, 0)
	setTitle(e.title);
	e.style.zIndex = zindex;
	e.style.display = '';
	
	var time = 50;
	var delay = 5000;
	window.setTimeout("setOpacity('"+e.id+"', 0.1)", 1*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.2)", 2*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.3)", 3*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.4)", 4*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.5)", 5*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.6)", 6*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.7)", 7*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.8)", 8*time);
	window.setTimeout("setOpacity('"+e.id+"', 0.9)", 9*time);
	window.setTimeout("setOpacity('"+e.id+"', 1.0)", 10*time);
	
	if (num+1 >= imgnodes.length)
		window.setTimeout("showpicture("+(0)+")", delay);
	else
		window.setTimeout("showpicture("+(num+1)+")", delay);

}