var pageSource = '';
var SrcLink = new Array();
var SrcText = new Array();
// Set speed in milliseconds
var speed = 3000; //Set at 10s
// Specify the image files
var Pic = new Array();

var curImgText='';
var displayText='';


/*** The Array of the URLs. These are the URLs for each of the image that comes up** */

SrcLink[0] = '/kids/Article?id=ar830213';
SrcLink[1] = '/kids/tutorial';
SrcLink[2] = '/kids/Article?id=ar831739#quiz';
SrcLink[3] = '/kids/Article?id=ar830298';
SrcLink[4] = '/kids/Article?id=ar831356';
SrcLink[5] = '/kids/Article?id=ar830339';
SrcLink[6] = '/kids/Article?id=ar831510';

/*** The Array of the Texts. These need to appear below the images on rollover on images***/
SrcText[0] = '';
SrcText[1] = 'Click the image to start the World Book Kids tour';
SrcText[2] = 'Play it!';
SrcText[3] = '';
SrcText[4] = '';
SrcText[5] = '';
SrcText[6] = '';

/* ** The image names of the feature for rotating ** */
Pic[0] = '/kids/img/splash_1.jpg';
Pic[1] = '/kids/img/splash_5.jpg'; 
Pic[2] = '/kids/img/splash_4.jpg';
Pic[3] = '/kids/img/splash_3.jpg'; 
Pic[4] = '/kids/img/splash_2.jpg';
Pic[5] = '/kids/img/splash_6.jpg'; 
Pic[6] = '/kids/img/splash_7.jpg';

/****************************************************
CODE BELOW IS APPLICATION LOGIC. DON't TOUCH
****************************************************/


var t;
var j = 0;
var p = Pic.length;

var preLoad = new Array();
for (i = 0; i < p; i++)
{
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}

//Rotate Image
function runIMGSlideShow()
{
	p = Pic.length; //Override with the actual size of the array
	var curURL = self.location.href; 
	var path = '';
	path = curURL.substring(curURL.lastIndexOf('.com')+5)
	if (path.match('/kids/Home') || path.match('') )
	{
		j = j + 1;
		if (j > (p-1)) j=0;
		document.myPicture.src=Pic[j];
		pageSource = SrcLink[j];
		curImgText = SrcText[j];
		displayText = curImgText;
		t = setTimeout('runIMGSlideShow()', speed);
	}
}

function sourceOfPicture()
{
   location.href = ''+pageSource;
   return false;
}
		
function showText()
{
   displayText = curImgText;
   return displayText;
}

function showCaption(arrIndex)
{
        ndSound=document.getElementById("wb-sde-lg-cap");
        ndSound.innerHTML=SrcText[j];
}
function hideCaption()
{
        ndSound=document.getElementById("wb-sde-lg-cap");
        ndSound.innerHTML="";
}				

