﻿var stopSlideShow = true;
var TimeoutSlideShowID;


function loadImgProd(nmSel, LinkObject, ImgClientID, LinkIDBase) {
    var i = 0;
    var arrLocal = eval('arrImgs' + ImgClientID);
    while (document.getElementById(LinkIDBase + i) != null) {
        document.getElementById(LinkIDBase + i).removeAttribute((document.all ? 'className' : 'class'), '');
        i++;
    }
    if (document.getElementById(LinkObject) != null) {
        document.getElementById(LinkObject).setAttribute((document.all ? 'className' : 'class'), 'pressed');
    }
    if (nmSel < arrLocal.length) {
        document.getElementById(ImgClientID).src = arrLocal[nmSel];
    }
    if (!stopSlideShow) {
        tmpNmSel = (nmSel + 1 < arrLocal.length) ? nmSel + 1 : 0;
        TimeoutSlideShowID = setTimeout("loadImgProd(" + tmpNmSel + ",'" + LinkIDBase + tmpNmSel + "','" + ImgClientID + "','" + LinkIDBase + "')", 1500);
    }
}

function autoSlideShow(nmSel, LinkObject, ImgClientID, LinkIDBase, act) {
    if (act == 'start') {
        stopSlideShow = false;
        nmSelstr = nmSel + 1;
        loadImgProd(nmSel + 1, LinkIDBase + nmSelstr, ImgClientID, LinkIDBase);
    } else {
        stopSlideShow = true;
        if (TimeoutSlideShowID != null) {
            clearTimeout(TimeoutSlideShowID)
        }
        loadImgProd(nmSel, LinkObject, ImgClientID, LinkIDBase);
    }
}