


//var galleryarray = new Array();
var control;
var iIntervalID;
var i = -1;
var slideshowInterval = 3000;

function setimg()
{
    document.getElementById("slideshow").setAttribute("src","images/slideshow/"+galleryarray[i]);
    document.getElementById("slideshow").setAttribute("alt",galleryarray[i] + " " + i);
    document.getElementById("slideshow").setAttribute("height","400");
}

function next()
{
   i++;
   if (i >= galleryarray.length)
   {
       i = 0;
   }
   setimg();
}

function back()
{
   i--;
   if (i < 0)
   {
       i = galleryarray.length - 1;
   }
   setimg();
}

function imgshow()
{
   document.getElementById("state").innerHTML = "blah";
   if (!iIntervalID)
   {
       
       iIntervalID = setInterval(next,slideshowInterval);
       document.getElementById("state").innerHTML = "STOP";
   }
   else
   {
       clearInterval(iIntervalID);
       iIntervalID = 0;
       document.getElementById("state").innerHTML = "START";
   }
}

function speed(n)
{
   if ((n == "up") && (slideshowInterval > 500))
   {
       slideshowInterval -= 500;
   }
   if (n == "dn") {
       slideshowInterval += 500;

       if (slideshowInterval > 500)
       {
           document.getElementById("up").innerHTML = "+";
       }

   }
   if (slideshowInterval == 500)
   {
       document.getElementById("up").innerHTML = "";
   }
   // restart the slideshow with new Interval value
   slideshow();
   slideshow();
}

