var imgs = new Array("images/rest_picrt02.jpg", "images/rest_picrt03.jpg", "images/rest_picrt04.jpg", "images/rest_picrt05.jpg", "images/rest_picrt01.jpg"),
preloadimgs = new Array(), reststart = true, restshowd=document.getElementById("idrestpicrt"), restime, n = 0;
var imgs2 = new Array("images/rest_piclft02.jpg", "images/rest_piclft03.jpg", "images/rest_piclft04.jpg", "images/rest_piclft05.jpg", "images/rest_piclft01.jpg"),
preloadimgs2 = new Array(), rest2showd=document.getElementById("idrestpiclft"), stopd=document.getElementById("idstop"), reststopind=false;

function preloadrestshow()
{
  for (var i = 0; i < imgs.length; i++)
  {
    preloadimgs[i] = new Image(); preloadimgs2[i] = new Image();
    preloadimgs[i].src = imgs[i];    preloadimgs2[i].src = imgs2[i];
  }
showrest();
}

function showrest()
{
   if (reststart)
   {
     restime = setTimeout ("showrest()", 4000);
     reststart = false;
   }
   else
   if (document.all)
   {
      restshowd.style.filter="blendTrans(duration=0.5)";
      restshowd.filters.blendTrans.Apply();
      restshowd.src= preloadimgs[n].src;
      restshowd.filters.blendTrans.Play();
      rest2showd.style.filter="blendTrans(duration=0.5)";
      rest2showd.filters.blendTrans.Apply();
      rest2showd.src= preloadimgs2[n].src;
      rest2showd.filters.blendTrans.Play();
      (n == (imgs.length - 1)) ? n = 0: n++;
      restime = setTimeout ("showrest()", 5000);
   }
   else
   {
      if (opfirstind)
      {
         clearTimeout(optim);
         opvarsp("showrest()", restshowd, rest2showd, 1);
      }
      else
      {
         restshowd.src= preloadimgs[n].src;
         rest2showd.src= preloadimgs2[n].src;
         opvarsp("showrest()", restshowd, rest2showd, 2);
         (n == (imgs.length - 1)) ? n = 0: n++;
      }
   }
}

function reststop(restind)
{
   if (restind == 1)
   {
      clearTimeout(restime);
      clearTimeout(optim);
      stopd.style.color = "#ff0000";
      reststopind = true;
   }
   else
   {
      if (reststopind)
      {
         showrest();
         stopd.style.color = "#cc9900";
         reststopind = false;
      }
      else
      {
         clearTimeout(restime);
         clearTimeout(optim);
         restime = setTimeout ("showrest()", 1);
      }
   }
}
