﻿var SysPpt=new SysPpt();
function SysPpt()
{
  this.run=Run;
  this.slideShowSpeed=8000;
  this.runStop=RunStop;
  this.runStart=RunStart;
  this.picSrc=new Array();
  this.picLink=new Array();
  this.img=new Array();

  this.index=0;
  this.runPPT=null;
  this.runSlideShow=RunSlideShow;
  function Run()
  {
    var pptImg=document.getElementById("SlideImg");
    var pptLink=document.getElementById("SlideLink");
    var pptButton=document.all["SlideButton"];
    if(pptImg==null)return; 
    if(pptButton==null)return; 
    for (var i = 0; i < this.picSrc.length; i++) 
    {
         this.img[i] = new Image();
         this.img[i].src = this.picSrc[i];
         pptButton[i].className="SlideButton1";
         pptButton[i].onmouseover=function(){this.className="SlideButton2";SysPpt.runStop(parseInt(this.getAttribute("index"))-1);};
         pptButton[i].onmouseout=function(){this.className="SlideButton1";SysPpt.runStart(parseInt(this.getAttribute("index"))-1);};
         pptButton[i].onclick=function(){pptLink.click()};
     }
     if(this.img[this.picSrc.length-1]!=null)
     {
        pptImg.src = this.img[this.picSrc.length-1].src;
        pptLink.href=this.picLink[this.picSrc.length-1];
      }
      
     this.runPPT=setInterval("SysPpt.runSlideShow()", this.slideShowSpeed);

  }


function RunSlideShow()
{ 
    var pptImg=document.getElementById("SlideImg");
    var pptLink=document.getElementById("SlideLink");
    if(pptImg==null)return;  
    pptImg.style.filter="revealTrans(duration=5,transition=23)";
    pptImg.style.filter="revealTrans(duration=crossFadeDuration,transition=23)";
    pptImg.filters.revealTrans.Apply();

     if(this.img[this.index]!=null)
     {
        pptImg.src = this.img[this.index].src;
        pptLink.href=this.picLink[this.index];
      }
     pptImg.filters.revealTrans.Play();
     this.index=this.index+1;
     if (this.index > (this.img.length - 1)) this.index = 0;
}

function RunStop(ind)
{
    if(this.runPPT!=null)clearInterval(this.runPPT);
    var pptImg=document.getElementById("SlideImg");
    var pptLink=document.getElementById("SlideLink");
    if(pptImg==null)return;
    
    pptImg.style.filter="revealTrans(duration=5,transition=23)";
    pptImg.style.filter="revealTrans(duration=crossFadeDuration,transition=23)";
    pptImg.filters.revealTrans.Apply();
    
    if(this.img[ind]!=null)
    {
      pptImg.src = this.img[ind].src;
      pptLink.href=this.picLink[ind];
    }
    pptImg.filters.revealTrans.Play();
}

function RunStart(ind)
{
     this.index=ind+1;
     if (this.index > (this.img.length - 1)) this.index = 0;
     this.runPPT=setInterval("SysPpt.runSlideShow()", this.slideShowSpeed);
}

}

