// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// 2005, modified by Franoszek, Concept! Miami, Inc. http://www.concept-miami.com
// all images passed from html page, no other list of images needed anymore
// quit show if only one image



var speedMS = 4000
var fadeDur = 2
var playShow = true
var onNext = false
var onPrev = false
var firstTime = 1
var to		// timeout
var j = 0

function initSlideShow(Images){
	var Pic = new Array()
	Pic = Images.split(',')
	var p = Pic.length
	if(p==1) return;	// if only one image: quit
	
	var preLoad = new Array()
	for (i = 0; i < p; i++){
	   preLoad[i] = new Image();
	   preLoad[i].src = Pic[i];
	}

	runSlideShow(preLoad,p)
}

function runSlideShow(preLoad,p){

   if(firstTime==1){
     speedMSFade = (speedMS/3);
	 firstTime=0;
   } else {
     speedMSFade = speedMS;
   }
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=fadeDur)"
      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
   to = setTimeout(callWithSetTimeout(runSlideShow,preLoad,p), speedMSFade)
}

function callWithSetTimeout(funcRef, a, b){ 
    /* Return a reference to the inner function created with 
       the function expression: 
    */ 
    return (function(){ 
        /* Call the function passed by reference as the first 
           argument to the outer function and pass all of the 
           2 remaining parameters to it as its arguments: 
        */ 
        funcRef(a, b); 
    }); 
} 