
var iCurrent;
var speed;
var delay;
var opac;
var imageid;
var divid;
var imagelist;

function registerimage(image)
{    if (imagelist==undefined){imagelist = new Array();}
     imagelist[imagelist.length] = image;
	 }

function StartSlides()
{  iCurrent = 0;
   speed = 50;
   delay = 5000;
   divid = 'blenddiv';
   imageid = 'blendimage';
   document.getElementById(imageid).src =imagelist[iCurrent]; 
   opac=100;
   changeopac();
   setTimeout("blend()", (delay * .20)); 
   }

function blend()
{  if (opac == 0){CycleLeadTimer()}
   if (opac <= 100)
	{	changeopac();
		opac = opac + 5;	
		setTimeout("blend()", speed);		
	}
	else
	{	iCurrent = iCurrent + 1;
		if (iCurrent > imagelist.length - 1) {iCurrent = 0;}
		
		//start the timer for the next image
		 setTimeout("blend()",delay); 
		
		//set the current image as background 
		document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
		
		//make image transparent 
		opac = 0;	
		changeopac(); 
		
		//slight delay to stop a flash in Firefox 
		setTimeout("loadnext()",50);
   }
}


function loadnext(){document.getElementById(imageid).src = imagelist[iCurrent]; }

function changeopac() 
{   var object = document.getElementById(imageid).style; 
    object.opacity = (opac / 100); 
    object.MozOpacity = (opac / 100); 
    object.KhtmlOpacity = (opac / 100); 
    object.filter = "alpha(opacity=" + opac + ")"; 
} 







