﻿//========================================
// @version:		1.0
// @modified:		20 April 2007
// @author:			Christopher Choyce
// @email:			chris@bizography.com
//========================================

	//------------------------------
	// Edit these
	//------------------------------
	var ImageFolder		= "images/logo01/"; // Folder in which all the images are located (relative to the html/asp page, NOT this file)
	// comma separated list of all the images we want to swap
	var ImagesToSwap	= "adidaslogo.gif,bellalogo.gif,championlogo.gif,dickieslogo.gif,gildan_logo.gif,hanes_logo.gif,jerzees_logo.gif,nikegolflogo.gif,ogio_logo.gif,redhouse_logo.gif,tw_logo.gif,green_logo.gif";	
	var ImageId				= "SwapImage"; // id of the img container that we want to swap
	var SwapDelay			= "3"; // # of seconds until the next image gets swapped in
	
	// Besure to add 'onload="SwapImages();"' to the body tag. This will start the animation affect
	
	//------------------------------
	// Edit nothing below here
	//------------------------------
	var ImageItems = ImagesToSwap.split(",");
	var ImageArray = new Array( );
	var ImageIndex = 0;

	// pre load all images
	for( var i = 0; i < ImageItems.length; i++ )
	{
		ImageArray[i] = new Image();
		ImageArray[i].src = ImageFolder + ImageItems[i];
	}
	
	// the intial call, ensures that the original image stays there for the SwapDelay
	function SwapImage( )
	{
		setTimeout(SwapImages, parseInt(SwapDelay)*1000);
	}
	
	// method that repeats the swapping
	function SwapImages( )
	{
		if( !document.getElementById)
			return;
		
		if( !document.getElementById(ImageId) )
		{
			alert("Error: image with id of '" + ImageId + "' was not found. Exiting script.");
			return;
		}
		
		document.getElementById(ImageId).src = ImageArray[ImageIndex].src;
		ImageIndex++;
		if( ImageIndex >= ImageArray.length )
			ImageIndex = 0;
		setTimeout(SwapImages, parseInt(SwapDelay)*1000);
	}
