// The list of images to display in the slideshow
//creating a array of the image object
var image=new Array("../images/image_property_01.jpg",
                    "../images/image_property_02.jpg",
                    "../images/image_property_03.jpg",
                    "../images/image_property_04.jpg",
                    "../images/image_property_05.jpg",
                    "../images/image_property_06.jpg",
                    "../images/image_property_07.jpg",
                    "../images/image_property_08.jpg",
                    "../images/image_property_09.jpg",
                    "../images/image_property_10.jpg"
                    
                    )
                
//variable that will increment through the images
var num=0

// set the delay between images
var timeDelay
 
//preload the images in the cache so that the images load faster
//create new instance of images in memory 

var imagePreload=new Array()
for (i=0;i<image.length;i++)
{
   imagePreload[i]=new Image()
// set the src attribute
imagePreload[i].src=image[i]
}


function image_effects()
{
     var selobj = document.getElementById('slidehow_transition');
     var selIndex = selobj.selectedIndex;
     //set the transition to the number selected in the list
     slideShow.filters.revealTrans.Transition=selIndex
     slideShow.filters.revealTrans.apply()
     slideShow.filters.revealTrans.play()
  
}

//function to get the previous image in the array
function previous_image()
{  
  //code to execute only when the automatic slideshow is disabled 
   if (slideshow.checked==false)
   {
    if (num>0)
    {
       num--
       image_effects()
       //set the SRC attribute to let the browser load the preloaded images 
       document.images.slideShow.src=image[num] 
     }
    if (num==0)
    {  //if first image is displayed
       num=image.length
       num--
       image_effects()
       document.images.slideShow.src=image[num] 
    } 
  }  
}

//function to get the next image in the array
function next_image()
{ 
  //code to execute only when the automatic slideshow is disabled 
  if (slideshow.checked==false)
  {
    if (num<image.length)
    {
       num++
       //if last image is reached,display the first image
       if (num==image.length) 
       num=0
       image_effects()
        //set the SRC attribute to let the browser load the preloaded images 
       document.images.slideShow.src=image[num]   
    }
  } 
}

//for automatic Slideshow of the Images
function slideshow_automatic()
{ 
if (slideshow.checked)
   {
    if (num<image.length)
     {
       num++
       //if last image is reached,display the first image
       if (num==image.length) 
       num=0
       image_effects()
       //sets the timer value to 4 seconds,we can create a timing loop by using the setTimeout method
       timeDelay=setTimeout("slideshow_automatic()",4000) 
       document.images.slideShow.src=image[num]   
     }
   }  
   if (slideshow.checked==false)
   { 
     //Cancels the time-out that was set with the setTimeout method. 
      clearTimeout(timeDelay)
   }
}
