﻿ function ImagesRotator() { 
    // ...
    //<% int imgCount = 0; foreach (FileInfo imageFile in imageFiles) { if (imgCount > 0) HttpContext.Current.Response.Write(", "); HttpContext.Current.Response.Write("\"" + Images_Location + imageFile.Name + "\""); imgCount++; } %>
  //  ImagesRotator.prototype.nextImage: new Image(), 
  //      ImagesRotator.prototype.imgNumber = 1; 
  //      ImagesRotator.prototype.activeElem = Get("I_<%imageFiles[0].Name.Substring(0, imageFiles[0].Name.Length - 5); %>"), 
  //      ImagesRotator.prototype.inactiveElem = Get("I_<% imageFiles[0].Name.Substring(0, imageFiles[0].Name.Length - 5); %>2"), 
   //     ImagesRotator.prototype.rotateTimer = 200,

}
 

 ImagesRotator.prototype.images = new Array();
        ImagesRotator.prototype.nextImage = new Image(); 
        ImagesRotator.prototype.imgNumber = 1; 
        ImagesRotator.prototype.activeElem = null; 
        ImagesRotator.prototype.inactiveElem = null; 
        ImagesRotator.prototype.rotateTimer = 200; 
        
        ImagesRotator.prototype.Rotate = function() { 
            this.nextImage = new Image();
            
            var closureThis = this;
            this.nextImage.onload = function() { closureThis.CrossFade(); };
            this.nextImage.src = this.images[this.imgNumber % this.images.length];
        }
        
        ImagesRotator.prototype.CrossFade = function() { 
            this.inactiveElem.src = this.nextImage.src;
            this.activeElem.style.zIndex = 2;
            this.inactiveElem.style.zIndex = 3;
            SetOpacity(this.inactiveElem, 1);
            this.inactiveElem.style.display = "inline";
            
            FadeOpacity(this.inactiveElem.id, 1, 100, 1000, 12);
            FadeOpacity(this.activeElem.id, 100, 1, 1000, 12);
            
            var closureThis = this;
            setTimeout(function() { closureThis.activeElem.style.display = "none"; var temp = closureThis.activeElem; closureThis.activeElem = closureThis.inactiveElem; closureThis.inactiveElem = temp; temp = null; closureThis.imgNumber++; }, 3000);
            this.rotateTimer = setTimeout(function() { closureThis.Rotate(); }, 5000);
        }
   
    
   // if (this.images.length > 1) this.rotateTimer = setTimeout(function() { this.Rotate(); }, 7000);
