    var picno_4 = 0
    var i_4 = 1
    var AdsToDisplay_4 = 1; 
    var x_4 = AdsToDisplay_4
    var ImageNumber_4 = 1;
    var counter_4 = 0;

// set the initial src 
document.images["imagexyz_4_1"].src = init_picture_4
document.links("xyzhref_4_1").href = init_href_4

 
	var numberofPics_4 = picture_4.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_4 < AdsToDisplay_4)
	{
		AdsToDisplay_4 = numberofPics_4
		x_4 = numberofPics_4
	}
		
		
		var num_4 = AdsToDisplay_4 - 1;
		var num2_4 = numberofPics_4 - num_4;


	function GetLinks_4(link)
	{
		document.location.href = splash_4[link];
	}
	
	
    function startClock_4()
    { 
		///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_4 = setTimeout("startClock_4()", 3700)
		{
			///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_4 < num2_4)
			{
				///This is the ad to display
				i_4 = x_4-1
				///specifies how many ads to display at a time
				if (counter_4 <= (AdsToDisplay_4-1))
				{
					for (var loop_4=0; loop_4 < AdsToDisplay_4; loop_4++)
					{
						///gets the name of the image holder
						var ImageName_4 = "imagexyz_4_" + (loop_4 + 1);
						
						///Gets the link associted with the ad
						var LinkNames_4 = "xyzhref_4_" + (loop_4 + 1);
						
						///displays the specified ad
						if (document.images(ImageName_4) != null)
							document.images[ImageName_4].src = picture_4[i_4 - counter_4];
						
						//adds the link to the splash page to the ad
						if (document.links(LinkNames_4) != null)
							document.links(LinkNames_4).href = splash_4[i_4 - counter_4];					
						
						counter_4++;
					}
				}
				else
				{
					///resetting the values below
					///for next rotation
					picno_4++;
					x_4++;
					ImageNumber_4 = 1;
					counter_4 = 0;
				}
			}
			else
			{
				///once all ads have been rotated through once
				///restart function and reset variables
				
				///Ensures ads do not start flickering
				clearTimeout(Timer_4);
				
				picno_4 = 0;
				i_4 = 1
				x_4 = AdsToDisplay_4
				ImageNumber_4 = 1;
				counter_4 = 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_4 < AdsToDisplay_4)
				{
					AdsToDisplay_4 = numberofPics_4
					x_4 = numberofPics_4
				}
				
				startClock_4();
			}
		}
    } 
    
    startClock_4();
