/***********************************************************************************************
	
	Copyright (c) 2005 - Alf Magne Kalleland post@dhtmlgoodies.com
	
	UPDATE LOG:
	
	March, 10th, 2006 : Added support for a message while large image is loading
	
	Get this and other scripts at www.dhtmlgoodies.com
	
	You can use this script freely as long as this copyright message is kept intact.
	
	***********************************************************************************************/ 
   	
	var displayWaitMessage=true;	// Display a please wait message while images are loading?
  	
   		
	var activeImage = false;
	var imageGalleryLeftPos = false;
	var imageGalleryWidth = false;
	var imageGalleryObj = false;
	var maxGalleryXPos = false;
	
	
	function showImage(nr){
		var slideshowImages = imageGalleryObj.getElementsByTagName('IMG');	
		var zahl=0;
		for(var no=0;no<slideshowImages.length;no++){
			zahl=no+1;
			
			if(nr==zahl){
				slideshowImages[no].src='slideshow/img/' +zahl + '_on.gif';	
			}else{
				slideshowImages[no].src='slideshow/img/' + zahl + '_off.gif';
			}

		}
		
	}
	
	function initSlideShow()
	{
	
		imageGalleryObj = document.getElementById('theImages');
		var slideshowImages = imageGalleryObj.getElementsByTagName('IMG');
		slideshowImages[0].src='slideshow/img/1_on.gif';
		var divs = imageGalleryObj.getElementsByTagName('DIV');
	}
	
	function showPreview(imagePath,imageIndex){
		var subImages = document.getElementById('previewPane').getElementsByTagName('IMG');
		if(subImages.length==0){
			var img = document.createElement('IMG');
			document.getElementById('previewPane').appendChild(img);
		}else img = subImages[0];
		
		if(displayWaitMessage){
			document.getElementById('waitMessage').style.display='inline';
		}
		img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); };
		img.src = imagePath;
	}
	
	
	function hideWaitMessageAndShowCaption(imageIndex)
	{
		document.getElementById('waitMessage').style.display='none';	
	
	}
	window.onload = initSlideShow;
