   
    var picno_1 = 0
    var i_1 = 1
    var AdsToDisplay_1 = 1; 
    var x_1 = AdsToDisplay_1
    var ImageNumber_1 = 1;
    var counter_1 = 0;

// set the initial src 
document.images["imagexyz_1_1"].src = init_picture_1
document.links("xyzhref_1_1").href = init_href_1
 
	var numberofPics_1 = picture_1.length
	
	
	///if the user had requested that more images
	///be displayed than are available in database
	///set no of images to be displayed to number 
	///in database
	if (numberofPics_1 < AdsToDisplay_1)
	{
		AdsToDisplay_1 = numberofPics_1
		x_1 = numberofPics_1
	}
		
		
		var num_1 = AdsToDisplay_1 - 1;
		var num2_1 = numberofPics_1 - num_1;


	function GetLinks_1(link)
	{
		document.location.href = splash_1[link];
	}
	
	
    function startClock_1()
    { 
		///rotates every x seconds
		///If the speed is set too quickly you will get flickering on the screen
		///as the code doesn't get enough time to run
		var Timer_1 = setTimeout("startClock_1()", 3500)
		{
			///This int specifies how many times the ad's will 
			///rotate , until all ads are shown
			///Once all ads are displayed, it restarts at the first ads
			if(picno_1 < num2_1)
			{
				///This is the ad to display
				i_1 = x_1-1
				///specifies how many ads to display at a time
				if (counter_1 <= (AdsToDisplay_1-1))
				{
					for (var loop_1=0; loop_1 < AdsToDisplay_1; loop_1++)
					{
						///gets the name of the image holder
						var ImageName_1 = "imagexyz_1_" + (loop_1 + 1);
						
						///Gets the link associted with the ad
						var LinkNames_1 = "xyzhref_1_" + (loop_1 + 1);
						
						///displays the specified ad
						if (document.images(ImageName_1) != null)
							document.images[ImageName_1].src = picture_1[i_1 - counter_1];
						
						//adds the link to the splash page to the ad
						if (document.links(LinkNames_1) != null)
							document.links(LinkNames_1).href = splash_1[i_1 - counter_1];					
						
						counter_1++;
					}
				}
				else
				{
					///resetting the values below
					///for next rotation
					picno_1++;
					x_1++;
					ImageNumber_1 = 1;
					counter_1 = 0;
				}
			}
			else
			{
				///once all ads have been rotated through once
				///restart function and reset variables
				
				///Ensures ads do not start flickering
				clearTimeout(Timer_1);
				
				picno_1 = 0;
				i_1 = 1
				x_1 = AdsToDisplay_1
				ImageNumber_1 = 1;
				counter_1 = 0;
				
				
				///if the user had requested that more images
				///be displayed than are available in database
				///set no of images to be displayed to number 
				///in database
				if (numberofPics_1 < AdsToDisplay_1)
				{
					AdsToDisplay_1 = numberofPics_1
					x_1 = numberofPics_1
				}
				
				startClock_1();
			}
		}
    } 
    
    startClock_1();