/**
 * History script based on MochiKit
 */

/**
 * Shows a certain image, hides the rest
 *
 * parameters:
 * id         : id to be set active -> usually your current element
 */
function showImage(id){

	hideAllImages();
	
	swapElementClass(id, 'notactive', 'active');
	
}

/**
 * Hides all images except the given ones
 *
 * parameters:
 * selectedImages : images that should remain highlighted
 */		
function hideImagesExcept(selectedImages){
	
	hideAllImages();
	
	/* selecteer de huidige pagina */
	if (selectedImages[0] != '')
	{
		for (i=0; i < selectedImages.length; i++) {
			swapElementClass(selectedImages[i], 'notactive', 'active');
		}
	}
	
}

/**
 * Hides all images
 *
 * parameters:
 * none
 */		
function hideAllImages(){

	/* klap alles dicht */
	var activeElements = new Array();
	
	activeElements = getElementsByTagAndClassName('li', 'active', 'history-images');
	
	for (i=0; i < activeElements.length; i++) {
	
		var currentElement = activeElements[i];
		swapElementClass(currentElement.id, 'active', 'notactive');
	
	}	
	
}

/**
 * Shows all images with a certain interval (currently 0.8 seconds)
 *
 * parameters:
 * none
 */	
function slideShow(){
	var timeout = 800;
	
	// start with all images closed
	hideAllImages();
	
	// show all images one at the time
	setTimeout("showImage('history-image1')",timeout * 1);
	setTimeout("showImage('history-image2')",timeout * 2);
	setTimeout("showImage('history-image3')",timeout * 3);
	setTimeout("showImage('history-image4')",timeout * 4);
	setTimeout("showImage('history-image5')",timeout * 5);
	
	// and hide again
	setTimeout("hideAllImages()",timeout * 6);

}