
////////////////////////////////////////////////////////////////////////////////////
//	ROTATING IMAGE HANDLING CODE
////////////////////////////////////////////////////////////////////////////////////
//	Administration Area
//	These variables are managed by the site admininstrator
//	Their settings contain a list the Images/URLs and control the behavior of the script


var ImageFolder = "../images/spinkids"; //Relative path to folder containing the images
var ImageFileNames = new Array(	
		'kidsImage1.jpg',
		'kidsImage2.jpg',
		'kidsImage3.jpg'
				


		
		
	); 	//Array of URLS for Images
var DefaultURL = 'index.asp'; //Default hyperlink for Image
var DisplayInterval = 3; //Number of seconds each Image is displayed
var TargetFrame = "self"; //Name of the frame to open the hyperlink into. If this is left blank, hyperlink is opened in new window

////////////////////////////////////////////////////////////////////////////////////
//	Operation Area
//	These internal variables are managed by the script and should not be changed

var IsValidBrowser = false;
var ImageCode = 0;
var Images = new Array(NumberOfImages);
//var ImageTitles = new Array(NumberOfImageTitles);
var DisplayInterval = DisplayInterval * 1000;
var NumberOfImages = ImageFileNames.length;
//var NumberOfImageTitles = TitleNames.length;


////////////////////////////////////////////////////////////////////////////////////
//	ImageFolder management
//	This script adds a trailing forward slash to the ImageFolder variable if it does not already have one


if (ImageFolder.substr(ImageFolder.length - 1, ImageFolder.length) != "/" && ImageFolder != "") {
	ImageFolder += "/";
}

////////////////////////////////////////////////////////////////////////////////////
//	Frameset Management
//	This script determines whether the Image Rotator is running in a frameset


if (TargetFrame == '') {
	var FramesObject = null;
	}
else {
	var FramesObject = eval('parent.' + TargetFrame);
	}

////////////////////////////////////////////////////////////////////////////////////
//	Description:	The Image Rotator script only runs of Netscape 3+ and Internet Explorer 4+
//					When page is loaded, this function performs the following tasks:
//					1.	Identifies browser name and version
//					2.	Sets timer variable to change Images at fixed interval
//					3.	Builds array to preload the Images
//	Preconditions:	Window object must exist
//	Postconditions:	BrowserType is set, TimerObject initialized, ImageCode initialized, Images Array initialized.
//	Arguments:		None
//	Return Values:	None


function InitializeImageRotator() {

	var BrowserType = navigator.appName;
	var BrowserVersion = parseInt(navigator.appVersion);

	if (BrowserType == "Netscape" && (BrowserVersion >= 3)) {
		IsValidBrowser = true;
	}

	if (BrowserType == "Microsoft Internet Explorer" && (BrowserVersion >= 4)) {
		IsValidBrowser = true;
	}

	if (IsValidBrowser) {
		TimerObject = setTimeout("ChangeImage()", DisplayInterval);
		ImageCode = 0;

		for (i = 0; i < NumberOfImages; i++) {
			Images[i] = new Image();
			Images[i].src = '' + ImageFolder + ImageFileNames[i];
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////
//	Descriptions:	This function increments the ImageCode variable
//					which then changes the SRC attribute of the image
//	Preconditions:	Window object must exist, InitializeImageRotator() script must have been invoked
//	Postconditions:	The ImageCode variable has been incremented, and Image SRC attribute has been changed
//	Arguments:		None
//	Return Values:	None


function ChangeImage() {

	if (IsValidBrowser) {
		ImageCode = ImageCode + 1;

		if (ImageCode == NumberOfImages) {
			ImageCode = 0;
		}

		
		//document.getElementById("rotate_section").firstChild.nodeValue = SectionNames[ImageCode];
		document.getElementById("rotate_image").src = Images[ImageCode].src;
		//window.document.rotate_image.src = Images[ImageCode].src;
		TimerObject = setTimeout("ChangeImage()", DisplayInterval);
	}
}

////////////////////////////////////////////////////////////////////////////////////
//	Description:	This function redirects the browser to a new location, based on
//					which image is being displayed
//					On old browsers, the DefaultURL is used
//	Preconditions:	Window object must exist, InitializeImageRotator() script must have been invoked
//	Postconditions:	The URL is opened in the specified window
//	Arguments:		None
//	Return Values:	None

function JumpToPage() {

	if (IsValidBrowser) {

		if (TargetFrame != '' && (FramesObject)) {
			FramesObject.location.href = ImageURLs[ImageCode];
		} else {
			window.open(ImageURLs[ImageCode]);
		}

	} else if (!IsValidBrowser) {
		window.open(DefaultURL);
	}
}

////////////////////////////////////////////////////////////////////////////////////
//	END ROTATING IMAGE HANDLING CODE
////////////////////////////////////////////////////////////////////////////////////
