
// array of pic names, maybe paths too
var arrPic = fetchImgNames() 
// array of preloaded image objects
var preLoad = null
var t
var j = 0
var p = 0



if (arrPic != null)
{
	p = arrPic.length
	preLoad = new Array()
	for (i = 0; i < p; i++)
	{
	   preLoad[i] = new Image()
	   preLoad[i].src = arrPic[i]
	}
	runSlideShow()
}

/**
 * Entry point. Idea is to get pic-names from a tag by id and the img-names
 * are in the tags value.
 */
function runSlideShow()
{

		var slideShowSpeed = 4000
		var crossFadeDuration = 3

   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

function fetchImgNames()
{
		var strImgTagName = "imgNames"
		var arrPic = null
		var objElement = document.getElementById(strImgTagName)
		
		if (objElement != null)
		{
			var strNames = objElement.value
			// alert("got name? " + strNames)
			
			arrPic = strNames.split("|")
	
		}
		else
		{
			alert("Images tag: " +strImgTagName+ " was not set!");
		}

		return arrPic
}
  


