﻿// JScript File

    function stopSlideShow() 
    {
      window.clearInterval(interval_id);
      interval_on = 0; 
    }


    function startSlideShow() 
    { 
      stopSlideShow();
      
      interval_on = 1;  
      interval_id = setInterval("loadNextImage()", c_interval);
       
    }
    
   
    function loadNextImage() 
    { 
      interval_on = 1;
      if (index == (maxPicCount - 1))
        index = 0;
      else  
        index++;
        
        
     if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
       { //test for MSIE x.x;
        var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
        if (ieversion>=5)
        {
            // document.write("You're using IE5 or above")
            loadingPhoto(bannerPics[index]);
        }
       }
     else
       {
         // document.write("n/a")
         document.getElementById("ImageBanner").src = bannerPics[index];
       }        
        
    }   
   
   
    function imageError(img)
    {
        //If image download errors occur, this function will be called.
        window.setTimeout("loadNextImage()", c_interval);
    }
    
    function imageLoaded(img)
    {
       var photo = document.getElementById("ImageBanner");   //Find the image control object
       photo.filters[0].apply();                       //Apply the transition effect
       photo.filters[0].play();                        //Play the effect and display the new image
       photo.src = img.src;                            //Assign the image to the image control
     
    }
 
   
    function loadingPhoto(imgPhoto)
    { 
       var img  = new Image();
       document.getElementById("ImageBanner").style.filter = "blendTrans(duration=1)"  
                
       img.onload = function(){ imageLoaded(this); }
       img.onerror = function(){ imageError(this); }
       img.onabort = function(){ imageError(this); }
       img.src = imgPhoto; 
        
    }

