﻿function PreloadImages(imgArray) {
    if (document.images) {
        preload_image_object = new Image();
        var i = 0;
        for (i = 0; i < window[imgArray].length; i++)
            preload_image_object.src = window[imgArray][i];
    }
}

function RotateImage(imageId, id) {
    $(imageId).setOpacity(0);

    var img = $(imageId).firstDescendant();

    if (img != null) {
        window['imgIndex_' + id]++;
        if (window['imgIndex_' + id] == window['images_' + id].length)
            window['imgIndex_' + id] = 0;
            
        img.setAttribute("src", window['images_' + id][window['imgIndex_' + id]]);
        $(imageId).childElements()[1].update(window['imgTxt_' + id][window['imgIndex_' + id]]);
    }

    $(imageId).appear();
}
