

 //declaring necessary local variables
 var img = new Array(10); //array to hold the images
 var start = null; //start pointer
 var counter = 1; //counts the image sequences
 var delayTime = null; //user defined


 if(document.images) //pre-load all the images
 {
   /* change the looping condition if you want
      to add or remove images. Do not load too
      many images, it will slow down the program's
      loading time [e.g. 30 or above images] */

   for(i = 1; i <= 4; i++)
   {
     img[i] = new Image();
     img[i].src = "/images/bgr" + i + ".jpg";
	 
   }
 }


 //function for getting the user defined delay time
 function getDelayTime()
 {
 
    delayTime = 5000;
 }


 //function for changing the images
 function anim()
 {
   counter++;
   var tabepl = document.getElementById ('tabl');
  tabepl.style.backgroundImage = 'url('+img[counter].src+')';
   if(counter == 4)
    counter = 0; //sets the counter value to 0
 }


 //function for starting the slide show
 function slide()
 { 
   getDelayTime();


     start = setInterval("anim()", delayTime);
    
 }


 //function to stop the slide show
 function stopSlide()
 {
   clearInterval(start);

 }

