<!--
var background='slideshow1';
var foreground='slideshow2';
var timer1=30;
var timer2=3500;
var delta=4;
var opacity=100;
var slideTimer;
var img=new Array();
for(var i=0;i<count;i++){
  img[i]=new Image();
  img[i].src="image1.php?"+variable+"."+i+".1.0.0";
}
var imgNum=((startNum))?startNum+1:1;
var last=imgNum-1;
if(document.getElementById('pic'+last)){
  document.getElementById('pic'+last).style.backgroundColor="#CCCCCC";
  document.getElementById('controls').innerHTML='<span id="cntrl0">'+imgNum+'/'+count+'</span>&nbsp;&nbsp;<span id="cntrl1"><button onClick="pause()">Pause</button></span>';
}
setBackground();
function setBackground(){
  if(img[imgNum].complete){
    if(document.getElementById('pic'+last)){
      document.getElementById('loading').style.visibility="hidden";
      document.getElementById('pic'+last).style.backgroundColor="#CCCCCC";
    }
    opacity=100;
    changeOpacity();
    document.getElementById(background).style.backgroundImage="url("+img[imgNum].src+")";
    slideTimer=setTimeout('changeImage()',timer2);
  }else{
    if(document.getElementById('pic'+last)){
      document.getElementById('loading').style.visibility="visible";
    }
    slideTimer=setTimeout('setBackground()',500);
  }
}
function changeImage(){
  opacity=opacity-delta;
  if(opacity<0){
    document.getElementById(foreground).style.backgroundImage="url("+img[imgNum].src+")";
    last=imgNum;
    imgNum++;
    if(imgNum>img.length-1){
      imgNum=0;
    }
    setBackground();
  }else{
    if(document.getElementById('pic'+imgNum) && opacity<50){
      document.getElementById('pic'+last).style.backgroundColor="#000000";
      document.getElementById('pic'+imgNum).style.backgroundColor="#CCCCCC";
      document.getElementById('cntrl0').innerHTML=(imgNum+1)+'/'+count;
    }
    changeOpacity();
    slideTimer=setTimeout('changeImage()',timer1);
  }
}
function changeOpacity(){
  var object = document.getElementById(foreground).style;
  object.opacity = (opacity / 100);
  object.filter = "alpha(opacity=" + opacity + ")";
}
function select(thisImage){
  document.getElementById('cntrl1').innerHTML='<button onClick="play()">Play</button>'
  clearTimeout(slideTimer);
  document.getElementById('pic'+imgNum).style.backgroundColor="#000000";
  document.getElementById('pic'+last).style.backgroundColor="#000000";
  imgNum=thisImage;
  document.getElementById('pic'+imgNum).style.backgroundColor="#CCCCCC";
  document.getElementById('cntrl0').innerHTML=(imgNum+1)+'/'+count;
  document.getElementById(foreground).style.backgroundImage="url("+img[imgNum].src+")";
  opacity=100;
  changeOpacity();
}
function pause(){
  select(last);
}
function play(){
  document.getElementById('cntrl1').innerHTML='<button onClick="pause()">Pause</button>'
  var next=imgNum+1
  if(next>img.length-1){
    next=0;
  }
  document.getElementById(background).style.backgroundImage="url("+img[next].src+")";
  document.getElementById('pic'+imgNum).style.backgroundColor="#000000";
    imgNum++;
    if(imgNum>img.length-1){
      imgNum=0;
    }
  changeImage();
}
//-->
