var slideShows = new Object();

//
var startSlideshow = function(id)
{	
	slideShows[id] = new Array();
	
	var pictureNodes = dojo.byId('container_slideshow_' + id).getElementsByTagName('div');
	
	for ( var i = 0; i < pictureNodes.length; i++ ) {
		var picture = new Object();
		picture["id"] = pictureNodes[i].id;
		picture["visible"] = ( 0 == i ) ? 1 : 0;
				
		slideShows[id][i] = picture;
	}
	
	window.setInterval(function() {changeSlides(id);}, 8000);
}

//
var changeSlides = function(id)
{
	var pictures = slideShows[id];
	var pictureOut, pictureIn;
	
	for ( var i = 0; i < pictures.length; i++ ) {
		var picture = pictures[i];
		
		if ( 1 == picture['visible'] ) {
			pictureOut = i;
			pictureIn  = i + 1;
		}
	}
	
	if ( pictureIn >= pictures.length ) {
		pictureIn = 0;
	}
	
	pictures[pictureOut]["visible"] = 0;
	pictures[pictureIn]["visible"] = 1;
	
	dojo.fadeOut({
		node: pictures[pictureOut]["id"],
		duration: 3000
	}).play();
	
	dojo.fadeIn({
		node: pictures[pictureIn]["id"],
		duration: 3000
	}).play();
}

//
var openPrintversion = function(url)
{
	var heigth = 900;
	var width  = 620;
	
	var screenWidth  = screen.width; 
	var screenHeight = screen.height; 
	
	var leftVal = screenWidth  / 2 - width  / 2;
	var topVal  = screenHeight / 2 - heigth / 2;
	
	newWindow = window.open(url, 'Print', 'width=' + width + ',height=' + heigth + ',left=' + leftVal + ',top=' + topVal);
	newWindow.focus();
}

