﻿   	/***********************************************************************************************
	
	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 auto_displayWaitMessage=true;	// Display a please wait message while images are loading?
	var auto_slideSpeed = 1500;
	var auto_imageGalleryCaptions = new Array();
	var isStopped = false;
	
	function auto_initSlideShow()
	{
		auto_selectImage(0);
		setTimeout('autoMoveSlide()', auto_slideSpeed);
	}
	
	function autoMoveSlide( )
	{
	    imageGalleryObj = document.getElementById('auto_theImages');
	    if(imageGalleryObj ==null)
	        return;
	    if (isStopped == false && imageGalleryObj != null)
	    {
	        var slideshowImages = imageGalleryObj.getElementsByTagName('IMG');
	        for (var no=0; no<slideshowImages.length;no++)
	            if (slideshowImages[no].className == 'StepSelectedPic')
	            {
	                auto_selectImage((no+1)%slideshowImages.length);
	                break;
	            }
		}
		if (imageGalleryObj != null)
		setTimeout('autoMoveSlide()', auto_slideSpeed);
	    
	}
	function auto_selectImage(index)
	{
	    try
		{
		    var subImagesForBorders = document.getElementById('auto_theImages').getElementsByTagName('IMG');
		    auto_showPreview(subImagesForBorders[index].src,index);
		    subImagesForBorders[index].className = 'StepSelectedPic';
		}
		catch(e){}
	}
	
	function auto_showPreview(imagePath,imageIndex){
	//alert(imagePath);
		var subImages = document.getElementById('auto_previewPane').getElementsByTagName('IMG');
		if(subImages.length==0){
			var img = document.createElement('IMG');
			document.getElementById('auto_previewPane').appendChild(img);
		}else img = subImages[0];
		
		//img.onload = function() { auto_hideWaitMessageAndShowCaption(imageIndex-1); };
		img.src = imagePath;
		
		var subImagesForBorders = document.getElementById('auto_theImages').getElementsByTagName('IMG');
		if(subImagesForBorders.length > 0)
		{
		    for(i=0;i<subImagesForBorders.length;i++)
		        subImagesForBorders[i].className = '';
		}
		
		
	}
	
	function startStrip()
	{
	    isStopped=false;
	}
	function stopStrip()
	{
	    isStopped=true;
	}
	
	//window.onload = auto_initSlideShow;