function SimpleSlideShow()
{
	this.Images;
	this.Width;
	this.Height;
	this.Preload;
	this.StartImageIndex;
	this.PreloadLength;
	this.SlideShowSpeed;
	this.CrossFadeDuration;
	this.Resize;
	

	// Databinding for property Images
	this.SetSlideShowImages = function(data)
	{
		///UserCodeRegionStart:[SetSlideShowImages] (do not remove this comment.)
		this.Images = data;
		
		var pic = new Array();
		var i = 0;
		for (i=0;this.Images[i]!=undefined;i++)
		{
		    pic[i] = this.Images[i].ImageLink;
		}
		
		this.StartImageIndex = 0
        this.PreloadLength = pic.length

        this.Preload = new Array()
        for (i = 0; i < this.PreloadLength; i++){
            this.Preload[i] = new Image()
            this.Preload[i].src = pic[i]
        }		
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	// Databinding for property Images
	this.GetSlideShowImages = function()
	{
		///UserCodeRegionStart:[GetSlideShowImages] (do not remove this comment.)
        return this.Images;		
		///UserCodeRegionEnd: (do not remove this comment.)
	}

	this.show = function()
	{
		///UserCodeRegionStart:[show] (do not remove this comment.)	
		
        if (!this.IsPostBack)		
		{
		    var buffer = "";
		    buffer+='<table border="0" cellpadding="0" cellspacing="0">';
            buffer+='<tr>';
            if (this.Resize)
            {
            	var imageSize = this.GetImageSize(this.Preload[0]);
	            buffer+='<td id="VU" height=' + imageSize.Height + ' width=' + imageSize.Width + '>';
                buffer+='<img src="' + this.Preload[0].src + '" name="SlideShow" height=' + imageSize.Height + ' width=' + imageSize.Width + '></td>';
            }            
            else
            {
                buffer+='<td id="VU">';
                buffer+='<img src="' + this.Preload[0].src + '" name="SlideShow"></td>';                
            }               
                
            buffer+='</tr>';
            buffer+='</table>';
            
            this.setHtml(buffer);        
		    this.runSlideShow();
		}
		///UserCodeRegionEnd: (do not remove this comment.)
	}
	///UserCodeRegionStart:[User Functions] (do not remove this comment.)

    //function runSlideShow(){
    this.runSlideShow = function()
    {
       var crossFadeDuration = this.CrossFadeDuration;
       if (document.all){
          document.images.SlideShow.style.filter="blendTrans(duration=2)"
          document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
          document.images.SlideShow.filters.blendTrans.Apply()      
       }
       document.images.SlideShow.src = this.Preload[this.StartImageIndex].src
	   var imageSize = this.GetImageSize(this.Preload[this.StartImageIndex]);
	   document.images.SlideShow.width = imageSize.Width; 
	   document.images.SlideShow.height = imageSize.Height;
			        
       if (document.all){
          document.images.SlideShow.filters.blendTrans.Play()
       }
       this.StartImageIndex = this.StartImageIndex + 1
       if (this.StartImageIndex > (this.PreloadLength-1))
       {
        this.StartImageIndex = 0;
        if (this.GetImages) this.GetImages();
       }       
       this.t = setTimeout(this.delegate(this,this.runSlideShow), this.SlideShowSpeed * 1000)
    }
    
    this.delegate = function(that, thatMethod)
    {
        return function() { return thatMethod.call(that); }
    }
    
    this.GetImageSize = function(anImage)
    {
    	var maxImageWidth = parseInt(this.Width);
    	var maxImageHeight = parseInt(this.Height);
    	var imageSize = new Object();
    	if (anImage.width <= maxImageWidth && anImage.height <= maxImageHeight)
    	{
    	    imageSize.Width = anImage.width;
    	    imageSize.Height = anImage.height;
    	}
    	else
    	{
    	    var relation = anImage.width / anImage.height;
    	    if (anImage.width > anImage.height)
    	    {
    	        var imageSize = this.MaximizeWidth(relation);
    	        if (imageSize.Height > this.Height)
    	            var imageSize = this.MaximizeHeight(relation);
    	    }
    	    if (anImage.height > anImage.width)
    	    {
                var imageSize = this.MaximizeHeight(relation);
    	        if (imageSize.Width > this.Width)
    	            var imageSize = this.MaximizeWidth(relation);                    	    }
    	    if (anImage.width == anImage.height)
    	    {
    	        var max = Math.max(maxImageWidth, maxImageHeight);
    	        imageSize.Width = max;
    	        imageSize.Height = max;
    	    }
    	}    	
    	return imageSize;
    }
    
    this.MaximizeWidth = function(relation)
    {
        var maxImageWidth = parseInt(this.Width);
    	var imageSize = new Object();
        imageSize.Width = maxImageWidth;
        imageSize.Height = Math.floor(maxImageWidth / relation);
        return imageSize;
    }

    this.MaximizeHeight = function(relation)
    {
        var maxImageHeight = parseInt(this.Height);
    	var imageSize = new Object();
        imageSize.Height = maxImageHeight;
        imageSize.Width = Math.floor(maxImageHeight * relation);
        return imageSize;
    }   	
	
	///UserCodeRegionEnd: (do not remove this comment.):
}


// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully
