
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 10000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var count = 1;
var max = 0;
var t;
var pause = true;

window.onload = function() {
	if(document.getElementById('slideshowBank'))
	{
		max = document.getElementById('slideshowBank').getElementsByTagName('img').length;
		if(max > 1)
			startSlideShow();
	}
}

function startSlideShow() {
	if(pause == true)
	{
		t = setInterval('runSlideShow()', SlideShowSpeed);
		pause = false;
	}
}
function runSlideShow() {

    count = count + 1;
    if (count > max)
		count = 1;
	
    if (document.all){
        document.images.ssM.style.filter="blendTrans(duration=2)";
        document.images.ssM.style.filter="blendTrans(duration=CrossFadeDuration)";
        document.images.ssM.filters.blendTrans.Apply();
    }
    document.images.ssM.src = document.getElementById('ssM'+count).src;
    document.images.ssM.alt = document.getElementById('ssM'+count).alt;
    document.getElementById('ssA').href = document.getElementById('ssA'+count).href;
    document.getElementById('ssA').target = document.getElementById('ssA'+count).target;
    document.getElementById('ssA').title = document.getElementById('ssA'+count).title;

    if (document.all) document.images.ssM.filters.blendTrans.Play();
}


function pauseSlideShow(){
	clearTimeout(t);
	pause = true;
}