// JavaScript Document
// 	Requirements:
//		2 image tags named SwapImage1 and SwapImage2 
//		An array of images named imgArray
//		An array of text named txtArray
var curOpacity=0;
var curPhoto=-1;
var curTest=-1;
var cycleInterval;
var fadeInterval;
var imgPhoto1;
var imgPhoto2;
var txtBlock;
var testimonial;

function FadeIn()
	{
	curOpacity += .03;
	imgPhoto1.style.opacity = (1-curOpacity);
	imgPhoto1.style.MozOpacity = (1-curOpacity);
	imgPhoto1.style.KhtmlOpacity = (1-curOpacity);
	imgPhoto1.style.filter = "alpha(opacity=" + ((1-curOpacity)*100) + ")";
	imgPhoto2.style.opacity = (curOpacity);
	imgPhoto2.style.MozOpacity = (curOpacity);
	imgPhoto2.style.KhtmlOpacity = (curOpacity);
	imgPhoto2.style.filter = "alpha(opacity=" + curOpacity*100 + ")";
	if (curOpacity >= 1)
		{
		clearInterval(fadeInterval);
		curPhoto = (curPhoto>=imgArray.length-1)?0:curPhoto+1;
		curTest = (curTest>=testArray.length-1)?0:curTest+1;
		}
	}
function CycleSlideShow()
	{
	curOpacity = 0;
	if (curPhoto==-1)
		{
		imgPhoto1.src = "images/blank.gif";
		imgPhoto2.src = imgArray[0];
		}
		else
		{
		imgPhoto1.src = imgArray[curPhoto];
		imgPhoto2.src = imgArray[(curPhoto<imgArray.length-1)?(curPhoto+1):0];
		}
	imgPhoto1.style.opacity = (1-curOpacity);
	imgPhoto1.style.MozOpacity = (1-curOpacity);
	imgPhoto1.style.KhtmlOpacity = (1-curOpacity);
	imgPhoto1.style.filter = "alpha(opacity=" + ((1-curOpacity)*100) + ")";
	imgPhoto2.style.opacity = (curOpacity);
	imgPhoto2.style.MozOpacity = (curOpacity);
	imgPhoto2.style.KhtmlOpacity = (curOpacity);
	imgPhoto2.style.filter = "alpha(opacity=" + curOpacity*100 + ")";
	txtBlock.innerHTML = txtArray[(curPhoto<imgArray.length-1)?(curPhoto+1):0];
	testimonial.innerHTML = testArray[(curTest<testArray.length-1)?(curTest+1):0];
	fadeInterval = setInterval("FadeIn()", 20);
	}
function SlideshowInit()
	{
	curOpacity = 0;
	testimonial = document.getElementById("TestimonialText");
	testimonial.innerHTML = testArray[curTest];
	txtBlock = document.getElementById("SwapPhotoTextDiv");
	txtBlock.innerHTML = txtArray[0];
	imgPhoto1 = document.getElementById("SwapImage1");
	imgPhoto1.style.opacity = (curOpacity);
	imgPhoto1.style.MozOpacity = (curOpacity);
	imgPhoto1.style.KhtmlOpacity = (curOpacity);
	imgPhoto1.style.filter = "alpha(opacity=" + curOpacity*100 + ")";
	imgPhoto2 = document.getElementById("SwapImage2");
	imgPhoto2.style.opacity = (curOpacity);
	imgPhoto2.style.MozOpacity = (curOpacity);
	imgPhoto2.style.KhtmlOpacity = (curOpacity);
	imgPhoto2.style.filter = "alpha(opacity=" + curOpacity*100 + ")";
	CycleSlideShow();
	cycleInterval = setInterval("CycleSlideShow()", 6000);
	}
