﻿function showPic (whichpic) {
    if (document.getElementById('placeholder') != null) {
        document.getElementById('placeholder').src = "i/gallery/" + whichpic + ".jpg";
        return false;
    } 
    else 
        return true;
}

//creating a array of the image object
var image=new Array(
    "i/gallery/gl01.jpg",
    "i/gallery/gl02.jpg",
    "i/gallery/gl03.jpg",
    "i/gallery/gl04.jpg",
    "i/gallery/gl05.jpg",
    "i/gallery/gl06.jpg",
    "i/gallery/gl07.jpg",
    "i/gallery/gl08.jpg",
    "i/gallery/gl09.jpg",
    "i/gallery/gl10.jpg",
    "i/gallery/gl11.jpg",
    "i/gallery/gl12.jpg",
    "i/gallery/gl13.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]
}

//for automatic Slideshow of the Images
function slideshow_automatic()
{ 
    if (document.getElementById('placeholder') != null)
    {
        //if last image is reached,display the first image
        if (num==image.length) 
            num=0
           
       //sets the timer value to 4 seconds, 
       //we can create a timing loop by using the setTimeout method
      // timeDelay=setTimeout("slideshow_automatic()",4000) 
           
       document.getElementById('placeholder').src = image[num];

       num++
   }
}




