//===========================================================
//Script:   JavaScript Cross-Browser SlideShow Script
//          With Cross-Fade Effect between Images
//          Adjustable Timing and Unlimited Images
//Function: Displays images continuously in a slideshow
//          presentation format, with a fade effect on
//          image transitions (IE only).
//Browsers: All common browsers: NS3-6, IE 4-6, Mozilla, Firefox
//          Fade effect only in IE; others degrade gracefully
//Author:   Adrian Bulgariu
//===========================================================

function runSlideShow(){
   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 change(path, width, height, speed, fadeDuration, picnr)
{
		// =======================================
		// seting the following variables
		// =======================================
		
		// Set slideShowSpeed (milliseconds)
		// 3000 = 3 sec this is default
		if ( speed == "" ) speed = 3000;
		slideShowSpeed = speed;
		
		// Duration of crossfade (seconds)
		// default 1000 = 1 sec
		if ( fadeDuration == "" ) fadeDuration = 1000;
		crossFadeDuration = fadeDuration;
		
		Pic = new Array() 
		// don't touch this
		picnr = picnr-1;
		for ( i = 0; i <= picnr; i++ )
			 {
				Pic[i] = path+i+'.jpg';
			 }
				
		var t;
		j = 0;
		p = Pic.length;
		
		preLoad = new Array()
		for (i = 0; i < p; i++){
		   preLoad[i] = new Image()
		   preLoad[i].src = Pic[i]
		}
		
		
		lista= "";
		lista += "<table border='0' cellpadding='0' cellspacing='0'>\n";
		lista += "<tr>\n";
		
		if ( width != "" && height != "" )
		{
			lista += "<td id='VU'>\n";
			lista += "<center><img src='"+path+"loading.jpg' name='SlideShow' width="+width+" height="+height+"><\/center><\/td>\n";
		}
		else
		{
			lista += "<td id='VU'>\n";
			lista += "<center><img src='"+path+"loading.jpg' name='SlideShow'><\/center><\/td>\n";

		}
		
		lista += "<\/tr>\n";
		lista += "<\/table>\n";
		document.write(lista);

}


