//=============================================================================================//
//		START - RunSlideShow2 - use with captions only										   //
//=============================================================================================//

function changeOpac2(opacity, id) 
{ 
 var object = document.getElementById(id).style;
 object.opacity = (opacity / 101); 
 object.MozOpacity = (opacity / 101); 
 object.KhtmlOpacity = (opacity / 101); 
 object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function blendimage2(divid, imageid, imagefile, millisec) 
{ 
var speed = Math.round(millisec / 10); 
var timer = 0; 

//set the current image as background 
//document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 

//make image transparent 
changeOpac2(0, imageid); 

//make new image 
document.getElementById(imageid).src = imagefile; 

//fade in image 
 for(i = 0; i <= 100; i++) 
 { 
  setTimeout("changeOpac2(" + i + ",'" + imageid + "')",(timer * speed)); 
  timer++; 
 }
 
//document.getElementById(divid).style.backgroundImage = ""
} 

var slideCache2 = new Array(); 
function RunSlideShow2(divid,imageid,imageFiles,captionid,imageCaptions,displaySecs) 
{ 
var imageSeparator = imageFiles.indexOf(";"); 
var nextImage = imageFiles.substring(0,imageSeparator); 
var captionSeparator = imageCaptions.indexOf(";"); 
var nextCaption = imageCaptions.substring(0,captionSeparator);

changeOpac2(0, imageid); 
blendimage2(divid,imageid,nextImage,100); 
document.getElementById(captionid).value = nextCaption;

var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)+ ';' + nextImage; 
var futureCaptions= imageCaptions.substring(captionSeparator+1,imageCaptions.length)+ ';' + nextCaption; 
futureCaptions = futureCaptions.replace(/\'/g,"\\'");
futureCaptions = futureCaptions.replace(/\"/g,'\\"');
setTimeout("RunSlideShow2('"+divid+"','"+imageid+"','"+futureImages+"','"+captionid+"','"+futureCaptions+"',"+displaySecs+")",displaySecs*1000); 

// Cache the next image to improve performance. 
imageSeparator = futureImages.indexOf(";"); 
nextImage = futureImages.substring(0,imageSeparator); 
	if (slideCache2[nextImage] == null) 
	{ 
	slideCache2[nextImage] = new Image; 
	slideCache2[nextImage].src = nextImage; 
	} 
}



//=============================================================================================//
//		START - RunSlideShow3 - use with captions and links									   //
//=============================================================================================//

function changeOpac3(opacity, id) 
{ 
 var object = document.getElementById(id).style;
 object.opacity = (opacity / 101); 
 object.MozOpacity = (opacity / 101); 
 object.KhtmlOpacity = (opacity / 101); 
 object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function blendimage3(divid, imageid, imagefile, millisec) 
{ 
var speed = Math.round(millisec / 10); 
var timer = 0; 

//make image transparent 
changeOpac3(0, imageid); 

//make new image 
document.getElementById(imageid).src = imagefile; 

//fade in image 
 for(i = 0; i <= 100; i++) 
 { 
  setTimeout("changeOpac3(" + i + ",'" + imageid + "')",(timer * speed)); 
  timer++; 
 }
} 

var slideCache3 = new Array(); 
function RunSlideShow3(divid,imageid,imageFiles,captionid,imageCaptions,linkid,imageLinks,displaySecs) 
{
	
var imageSeparator = imageFiles.indexOf(";"); 
var nextImage = imageFiles.substring(0,imageSeparator); 
var captionSeparator = imageCaptions.indexOf(";"); 
var nextCaption = imageCaptions.substring(0,captionSeparator);
var linkSeparator = imageLinks.indexOf(";"); 
var nextLink = imageLinks.substring(0,linkSeparator);

changeOpac3(0, imageid); 
blendimage3(divid,imageid,nextImage,100); 
document.getElementById(captionid).value = nextCaption;
document.getElementById(linkid).value = nextLink;

var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)+ ';' + nextImage; 
var futureCaptions= imageCaptions.substring(captionSeparator+1,imageCaptions.length)+ ';' + nextCaption; 
futureCaptions = futureCaptions.replace(/\'/g,"\\'");
futureCaptions = futureCaptions.replace(/\"/g,'\\"');
var futureLinks= imageLinks.substring(linkSeparator+1,imageLinks.length)+ ';' + nextLink;
futureLinks = futureLinks.replace(/\'/g,"\\'");
futureLinks = futureLinks.replace(/\"/g,'\\"');


setTimeout("RunSlideShow3('"+divid+"','"+imageid+"','"+futureImages+"','"+captionid+"','"+futureCaptions+"','"+linkid+"','"+futureLinks+"',"+displaySecs+")",displaySecs*1000); 

// Cache the next image to improve performance. 
imageSeparator = futureImages.indexOf(";"); 
nextImage = futureImages.substring(0,imageSeparator); 
	if (slideCache3[nextImage] == null) 
	{ 
	slideCache3[nextImage] = new Image; 
	slideCache3[nextImage].src = nextImage; 
	} 
}


