﻿// JScript File


// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 8000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var count = 1;
var max = 0;
var ts;
var pause = true;

/* look in homeSlide.js
window.onload = function() {
	if(document.getElementById('slideshowBank'))
	{
		max = document.getElementById('slideshowBank').getElementsByTagName('img').length;
		if(max > 1)
			startSlideShow();
	}
}*/

function init_homeBannerFade() {
	max = document.getElementById('slideshowBank').getElementsByTagName('img').length;
	if(max > 1)
		startSlideShow();
}

function startSlideShow() {
	if(pause == true)
	{
		ts = 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;

    if (document.all) document.images.ssM.filters.blendTrans.Play();
}


function pauseSlideShow(){
	clearTimeout(ts);
	pause = true;
}