var c=0;
var t;
var t1;
var t2;
var timer_is_on=0;
var timer_is_on2=0;
var timestep=30;
var opaque=100;
var transparent=0;
var opIEin=0;
var opFFin=0.0;
var opIEout=100;
var opFFout=1.0;
var ImgElement;
var divElement;
var slideArray;

function doSlideShow(DivID, ImgID, SlideList)
{

  slideArray=SlideList;
  ImgElement=ImgID;
  DivElement=DivID;
  

  if (!timer_is_on)
  {
  timer_is_on=1;
  changeimage();
  }
}


function changeimage()
{
  if (!timer_is_on2)
  {
    if (c>(slideArray.length-1))
    {
      c=0;
    }

    if (c<(slideArray.length-1))
    {
      document.getElementById(DivElement).style.backgroundImage="url('"+slideArray[c+1].src+"')";
    }
    else
    {
      document.getElementById(DivElement).style.backgroundImage="url('"+slideArray[0].src+"')";
    } 

    document.getElementById(ImgElement).src=slideArray[c].src;
    document.getElementById(ImgElement).style.opacity="1.0";
    document.getElementById(ImgElement).style.filter="alpha(opacity=100)";
  
    c=c+1;

    t2=setTimeout("FadeOut()",4200);
    timer_is_on2=1;
    t=setTimeout("changeimage()",7000);
  }
  else
  {
      t=setTimeout("changeimage()",1000) // wait a second
  }

}

function FadeOut()
{

 document.getElementById(ImgElement).style.opacity=opFFout;
 document.getElementById(ImgElement).style.filter="alpha(opacity="+opIEout+")";

 opFFout= opFFout - 0.02;
 opIEout= opIEout - 2;
 
 if (opIEout > transparent)
 {
   t2=setTimeout("FadeOut()",timestep);
 }
 else
 {
   
   opFFout= 1.0;
   opIEout= 100;
   timer_is_on2=0;

 }


}
function FadeIn()
{

 document.getElementById(ImgElement).style.opacity=opFFin;
 document.getElementById(ImgElement).style.filter="alpha(opacity="+opIEin+")";

 opFFin= opFFin + 0.02;
 opIEin= opIEin + 2;
 
 if (opIEin < opaque)
 {
   t1=setTimeout("FadeIn()",timestep);
 }
 else
 {
   
   opFFin= 0.0;
   opIEin= 0;
 }


}


