// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the slideshow variables
// =======================================
var slideShowSpeed = 4000; // Set slideShow Speed in milliseconds
var crossFadeDuration = 2; // Duration of crossfade in seconds

// Preload the images
var preLoad = new Array();

preLoad[0] = new Image();
preLoad[0].src = 'images/header2.jpg';

preLoad[1] = new Image();
preLoad[1].src = 'images/header3.jpg';

preLoad[2] = new Image();
preLoad[2].src = 'images/header4.jpg';

preLoad[3] = new Image();
preLoad[3].src = 'images/header1.jpg';

// set their names
var imageNames = new Array();

imageNames[0] = 'url(images/header1.jpg)';
imageNames[1] = 'url(images/header2.jpg)';
imageNames[2] = 'url(images/header3.jpg)';
imageNames[3] = 'url(images/header4.jpg)';

// Declare looping vars
var t;
var j = 1;
var p = preLoad.length;


function runSlideShow(){

	var theHeader = document.getElementById("header");
	
	// set a blending transition (for IE)
	if (document.all){
		theHeader.style.filter="blendTrans(duration=2)"
		theHeader.style.filter="blendTrans(duration=crossFadeDuration)"
		theHeader.filters.blendTrans.Apply()      
	}

	// switch the image and set its properties
	theHeader.style.backgroundImage = imageNames[j];
	
	// apply the blending transition
	if (document.all){
		theHeader.filters.blendTrans.Play()
	}
	
	// increment the counter
	j = j + 1;
	
	// if counter is beyond the end of the array, return to beginning
	if (j > (p-1)) j=0;
	
	// set this function to execute again in defined # of milliseconds
	t = setTimeout('runSlideShow()', slideShowSpeed);
}


