var ultimateshow=new Array();
 var httpObject = null;


// Get the HTTP Object
 function getHTTPObject(){
 	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
 	else if (window.XMLHttpRequest) return new XMLHttpRequest();
 	else {
 		alert("Your browser does not support AJAX.");
 		return null;
 	}
 }
var currentslide=0

function loadFirstImage(imageLocation) {
 	document.getElementById('slidensmain').innerHTML = '<img src="'+imageLocation+'" border="0" />'

}

 // Change the value of the outputText field
 function setArrayValues(){
 	if(httpObject.readyState == 4){

		var index = ultimateshow.length;
		var imagePaths = httpObject.responseText.split("{{{");
		if (imagePaths.length > 1) {
			var cacheimage=new Image();
			cacheimage.onLoad=loadFirstImage(imagePaths[0]);
			cacheimage.src=imagePaths[0];

			if (imagePaths.length > 2) {
				currentslide=1
			}
			// use imagePaths.length-1 because of trailing "{{{"
			for (i=0; i<imagePaths.length-1; i++) {
				ultimateshow[index]=[imagePaths[i], '', '']
				index++;
			}
 			if (preloadimages=="yes"){
 				for (i=1;i<ultimateshow.length;i++){
				 	var cacheimage=new Image()
				 	cacheimage.src=ultimateshow[i][0]
 				}
			}
		}
 	}
 }



 
 	httpObject = getHTTPObject();
 	if (httpObject != null) {
 		httpObject.open("GET", "ajoyImages/getimagepaths.php?search_keywords=4website", true);
 		httpObject.send(null);
 		httpObject.onreadystatechange = setArrayValues;
 	}

 
// ultimateshow[0]=['images/ajoy1.jpg', '', '']
// ultimateshow[1]=['images/ajoy2.jpg', '', '']
// ultimateshow[2]=['images/ajoy3.jpg', '', '']
 
 //configure the below 3 variables to set the dimension/background color of the slideshow
 
 var slidewidth="640px" //set to width of LARGEST image in your slideshow
 var slideheight="480px" //set to height of LARGEST iamge in your slideshow
 var slidecycles="continuous" //number of cycles before slideshow stops (ie: "2" or "continous")
 var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
 var preloadimages="yes" //preload images? "yes" or "no"
 var slidebgcolor='white'
 
 //configure the below variable to determine the delay between image rotations (in miliseconds)
 var slidedelay=5000
 
 ////Do not edit pass this line////////////////
 
 var ie=document.all
 var dom=document.getElementById
 var curcycle=0
 var playImages=false
 var timeoutId=false
 var firstTime=true
 
 
  
 
 function rotateimages(){
 	if (playImages)
 	{
 		document.getElementById('slidensmain').innerHTML = '<img src="'+ultimateshow[currentslide][0]+'" border="0" />'
 		if (currentslide==ultimateshow.length-1) 
 			currentslide=0
 		else 
 			currentslide++
 		timeoutId=setTimeout("rotateimages()",slidedelay)
 	}
 }
 
 function startImages() {
 	if (playImages !== true){
 		playImages=true;
		if (firstTime) {
 			firstTime=false;
 			timeoutId=setTimeout("rotateimages()",slidedelay);
		}
		else {
			rotateimages();
		}
 	}
 }
 
 function stopImages() {
	if (timeoutId) {
		clearTimeout(timeoutId);
	}
 	playImages=false;
 }
 
 if (ie||dom)
 window.onload=startImages;

 if (ie||dom)
	window.onUnload=stopImages;

