var secs
var timerID = null
var timerRunning = false
var delay = 1000

function runSlideShow()
{
    // Set the length of the timer, in seconds
    secs = 8
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==7)
    {
    	runSlideShow1()
    }
    if (secs==5)
    {
    	runSlideShow2()    
    }
    if (secs==3)
    {
        	runSlideShow3()
    }
    if (secs==1)
    {
        	runSlideShow4()
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}



///first ss

var SlideShowSpeed1 = 5.000;		// Number of seconds between the start of each cross-fade.
var CrossFadeDuration1 = 1.0;	// Number of seconds the cross-fade lasts.
var Picture1 = new Array(); 


//Picture1[1]  = 'slideshow/1.jpg';
Picture1[1]  = 'slideshow/1.jpg';
Picture1[2]  = 'slideshow/2.jpg';
Picture1[3]  = 'slideshow/3.jpg';
Picture1[4]  = 'slideshow/4.jpg';
Picture1[5]  = 'slideshow/5.jpg';
Picture1[6]  = 'slideshow/6.jpg';


var tss1;
var iss1;
var jss1 = 1;
var pss1 = Picture1.length-1;

var preLoad1 = new Array();
for (iss1 = 1; iss1 < pss1+1; iss1++)
{
	preLoad1[iss1] = new Image();
	preLoad1[iss1].src = Picture1[iss1];
}

function runSlideShow1()
{	
	//alert('SS 1');
	if (document.all)
	{
		document.images.PictureBox1.style.filter="blendTrans(duration=" + CrossFadeDuration1 + ")";
		document.images.PictureBox1.filters.blendTrans.Apply();
	}
	document.images.PictureBox1.src = preLoad1[jss1].src;
	if (document.all)
	{
		document.images.PictureBox1.filters.blendTrans.Play();
	}
	jss1 = jss1 + 1;

	if (jss1 > pss1)
	{
		jss1 = 1;
	}

	tss1 = setTimeout('runSlideShow1()', SlideShowSpeed1 * 1000.0);
}



//---second ss

var SlideShowSpeed2 = 4.000;		// Number of seconds between the start of each cross-fade.
var CrossFadeDuration2 = 1.0;	// Number of seconds the cross-fade lasts.
var Picture2 = new Array(); 


//Picture2[1]  = 'slideshow/thumbnail1a.jpg';
Picture2[1]  = 'slideshow/thumbnail1a.jpg';
Picture2[2]  = 'slideshow/thumbnail1g.jpg';
Picture2[3]  = 'slideshow/thumbnail1c.jpg';
Picture2[4]  = 'slideshow/thumbnail1d.jpg';
Picture2[5]  = 'slideshow/thumbnail1f.jpg';
Picture2[6]  = 'slideshow/thumbnail1e.jpg';
Picture2[7]  = 'slideshow/thumbnail1b.jpg';


var tss2;
var iss2;
var jss2 = 1;
var pss2 = Picture2.length-1;

var preLoad2 = new Array();
for (iss2 = 1; iss2 < pss2+1; iss2++)
{
	preLoad2[iss2] = new Image();
	preLoad2[iss2].src = Picture2[iss2];
}

function runSlideShow2()
{
	if (document.all)
	{
		document.images.PictureBox2.style.filter="blendTrans(duration=" + CrossFadeDuration2 + ")";
		document.images.PictureBox2.filters.blendTrans.Apply();
	}
	document.images.PictureBox2.src = preLoad2[jss2].src;
	if (document.all)
	{
		document.images.PictureBox2.filters.blendTrans.Play();
	}
	jss2 = jss2 + 1;

	if (jss2 > pss2)
	{
		jss2 = 1;
	}

	tss2 = setTimeout('runSlideShow2()', SlideShowSpeed2 * 1000.0);
}


//-- third ss

var SlideShowSpeed3 = 6.000;		// Number of seconds between the start of each cross-fade.
var CrossFadeDuration3 = 1.0;	// Number of seconds the cross-fade lasts.
var Picture3 = new Array(); 


//Picture3[1]  = 'slideshow/thumbnail2a.jpg';
Picture3[1]  = 'slideshow/thumbnail2g.jpg';
Picture3[2]  = 'slideshow/thumbnail2a.jpg';
Picture3[3]  = 'slideshow/thumbnail2c.jpg';
Picture3[4]  = 'slideshow/thumbnail2d.jpg';
Picture3[5]  = 'slideshow/thumbnail2e.jpg';
Picture3[6]  = 'slideshow/thumbnail2f.jpg';
Picture3[7]  = 'slideshow/thumbnail2b.jpg';

var tss3;
var iss3;
var jss3 = 1;
var pss3 = Picture3.length-1;

var preLoad3 = new Array();
for (iss3 = 1; iss3 < pss3+1; iss3++)
{
	preLoad3[iss3] = new Image();
	preLoad3[iss3].src = Picture3[iss3];
}

function runSlideShow3()
{
	if (document.all)
	{
		document.images.PictureBox3.style.filter="blendTrans(duration=" + CrossFadeDuration3 + ")";
		document.images.PictureBox3.filters.blendTrans.Apply();
	}
	document.images.PictureBox3.src = preLoad3[jss3].src;
	if (document.all)
	{
		document.images.PictureBox3.filters.blendTrans.Play();
	}
	jss3 = jss3 + 1;

	if (jss3 > pss3)
	{
		jss3 = 1;
	}

	tss3 = setTimeout('runSlideShow3()', SlideShowSpeed3 * 1000.0);
}

//-- fourth ss

var SlideShowSpeed4 = 5.000;		// Number of seconds between the start of each cross-fade.
var CrossFadeDuration4 = 1.0;	// Number of seconds the cross-fade lasts.
var Picture4 = new Array(); 


//Picture4[1]  = 'slideshow/thumbnail3a.jpg';
Picture4[1]  = 'slideshow/thumbnail3a.jpg';
Picture4[2]  = 'slideshow/thumbnail3b.jpg';
Picture4[3]  = 'slideshow/thumbnail3f.jpg';
Picture4[4]  = 'slideshow/thumbnail3d.jpg';
Picture4[5]  = 'slideshow/thumbnail3e.jpg';
Picture4[6]  = 'slideshow/thumbnail3c.jpg';

var tss4;
var iss4;
var jss4 = 1;
var pss4 = Picture4.length-1;

var preLoad4 = new Array();
for (iss4 = 1; iss4 < pss4+1; iss4++)
{
	preLoad4[iss4] = new Image();
	preLoad4[iss4].src = Picture4[iss4];
}

function runSlideShow4()
{
	if (document.all)
	{
		document.images.PictureBox4.style.filter="blendTrans(duration=" + CrossFadeDuration4 + ")";
		document.images.PictureBox4.filters.blendTrans.Apply();
	}
	document.images.PictureBox4.src = preLoad4[jss4].src;
	if (document.all)
	{
		document.images.PictureBox4.filters.blendTrans.Play();
	}
	jss4 = jss4 + 1;

	if (jss4 > pss4)
	{
		jss4 = 1;
	}

	tss4 = setTimeout('runSlideShow4()', SlideShowSpeed4 * 1000.0);
}

