///// Plugin variables

dotrans=1; // if value = 1 then there are transitions played in IE
transtype='blendTrans';// 'blendTrans' or 'revealtrans'
transattributes='23';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i=0;

//###########################################

window.onload=function(){

	//preload images into browser
	preloadSlide();

	//set transitions
//	GetTrans();

	//set the first slide
	SetSlide(0);

	//autoplay
	PlaySlide();
}

//###########################################
function SetSlide(num)
{
	//too big
	i=num%theimage.length;
	//too small
	if(i<0) i=theimage.length-1;

	crossfade(document.getElementById('imgslide'), theimage[i][0], '2', '');

	//switch the image
//	if(document.all&&!window.opera&&dotrans==1)eval('document.imgslide.style.filters.'+transtype+'.Apply()');
//	document.images.imgslide.src=theimage[i][0];
//	if(document.all&&!window.opera&&dotrans==1)eval('document.imgslide.style.filters.'+transtype+'.Play()');
}

//###########################################
function PlaySlide() {
	if (!window.playing)
	{
		PlayingSlide(i+1);
		//if(document.slideshow.play){
		//	document.slideshow.play.value="   Stop   ";
		//}
	} else
	{
		playing=clearTimeout(playing);
		//if(document.slideshow.play){
		//	document.slideshow.play.value="   Play   ";
		//}
	}
	// if you have to change the image for the "playing" slide
	if(document.images.imgPlay)
	{
		setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
		imgStop=document.images.imgPlay.src;
	}
}

//###########################################
function PlayingSlide(num) {
	playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
}

//###########################################
//desc: picks the transition to apply to the images
//function GetTrans() {
//}

//###########################################
function preloadSlide()
{
	for(k=0;k<theimage.length;k++)
	{
		theimage[k][0]=new Image().src=theimage[k][0];
	}
}
