﻿var the_timeout;
var CrossFadeDuration = 3;
var TimedDelay = 4000;

function RotateImage(index)
{

if( typeof(imgRotateImage) != 'undefined')
{
    if( document.getElementById(imgRotateImage) != null) {
        image = document.getElementById(imgRotateImage);
        
        if (document.all){
            image.style.filter="blendTrans(duration=2)";
            image.style.filter="blendTrans(duration=CrossFadeDuration)";
            image.filters.blendTrans.Apply();
        }
        
        image.src = imgRotateArray[index].src;
        
        if (document.all){
            image.filters.blendTrans.Play();
        }
        
        index++;
        if (index >= imgRotateArray.length)
        {
           index = 0;
        }
        
        var the_function_string = "RotateImage(" + index + ");";
        the_timeout = setTimeout(the_function_string, TimedDelay);
           
           
    }
}
}

function initRotateImage()
{
    RotateImage(0);
}

addEvent(window, 'load', initRotateImage);

