var thisSlide = 0;	var slideshow;var	next_string = " clearTimeout(slideshow); slideshow = setTimeout('displaySlide()',5);  ";var	back_string = "thisSlide = thisSlide-2; clearTimeout(slideshow); slideshow = setTimeout('displaySlide()',5);";var	play_string = "slideshow = setTimeout('displaySlide()', duration)";var	stop_string = "clearTimeout(slideshow)";var next_tag = "<input type=\"image\" src=\"images\/gallery\/slideshow_next.jpg\" value=\"Next\" onclick=\"" + next_string + "\">";var back_tag = "<input type=\"image\" src=\"images\/gallery\/slideshow_back.jpg\" value=\"Back\" onclick=\"" + back_string + "\">";var play_tag = "<input type=\"image\" src=\"images\/gallery\/slideshow_play.jpg\" value=\"Play\" onclick=\"" + play_string + "\">";var stop_tag = "<input type=\"image\" src=\"images\/gallery\/slideshow_pause.jpg\" value=\"Stop\" onclick=\"" + stop_string + "\">";var count_tag = "Slideshow";var duration = 3000;var theDivArray = Array("slideshow_image", "slideshow_controls");	//build array of image urlsvar src = Array();for (var i=0; i < imagesArray; i++){	src.push(root_directory + "/" + (i+1) + ".jpg");}//create an image object to preload images into, and preload the first imagevar nextImage = new Image;nextImage.src = src[0];var	numberSlides = imagesArray;//get the imageContainer div and clear itvar imageContainer = document.getElementById(theDivArray[0]);while( imageContainer.hasChildNodes() ) { 	imageContainer.removeChild( imageContainer.lastChild ); };//create the image element and add it imageContainer divvar image=document.createElement("img");image.setAttribute("src", root_directory + "/1.jpg");imageContainer.appendChild(image);//get the slideshow controls container var controlsContainer = document.getElementById(theDivArray[1]);//add the controlscontrolsContainer.innerHTML = play_tag + stop_tag + back_tag + next_tag;//add the counter divvar counter =  document.createElement("div"); counter.setAttribute("id", "slideshow_counter");var counterText = document.createTextNode(count_tag);counter.appendChild(counterText);controlsContainer.appendChild(counter);slideshow = setTimeout('displaySlide()', 2);function displaySlide(){		if (nextImage && (nextImage.complete || nextImage.complete==null)) {				thisSlide++		switch(true){			case (thisSlide > numberSlides):				thisSlide= 1;				break;			case (thisSlide < 1):				thisSlide = numberSlides;				break;		}				if (thisSlide == numberSlides){			nextSlide_index= 0;		}else{				nextSlide_index = thisSlide;		}		image.src = nextImage.src;		nextImage.src = src[nextSlide_index];		counterText.nodeValue =  "" + String(thisSlide) + " of " + String(numberSlides) + "";	}	slideshow = setTimeout('displaySlide()', duration);		}