/*
******** TESTIMONIAL 2 *********
*/

//*** Weisse Überblendung an/aus ***
function testimonial2activatesmallimage(imageNumber, activate) {
    var name = "testimonial2-thumbnaildiv" + imageNumber;
    if (activate)
        document.getElementById(name).className = "testimonial2active";
    else
        document.getElementById(name).className = "testimonial2inactive";
}

//*** Gallery soll gescrollt werden und links erhalten ***
function galleryscroll(listCount, backwards, id)
{
    var name;
    var imagepath;
    var j;
    var temp;

    //pos 0 sichern
    if (backwards)
    {
        temp = document.getElementById(id + (listCount - 1)).innerHTML;
    }
    else
    {
        temp = document.getElementById(id + 0).innerHTML;
    }

    //alle innerhtmls um eins verrutschen
    for (var i = 0; i < listCount; i++)
    {
        name = id + i;
        var currentnode;

        if (backwards) 
        {
            //inhalt nach rechts schieben = links geklickt
            var currentnode = document.getElementById(id + (listCount - 1 - i));
            if ((listCount - 1 - i) > 0)
            {
                currentnode.innerHTML = document.getElementById(id + (listCount - 2 - i)).innerHTML;
            }
            else
            {
                currentnode.innerHTML = temp;
            }
        }
        else
        {
            //inhalt nach links schieben = rechts geklickt
            currentnode = document.getElementById(name);
            if ((i + 1) < listCount)
            {
                currentnode.innerHTML = document.getElementById(id + (i + 1)).innerHTML;
            }
            else
            {
                currentnode.innerHTML = temp;
            }
        }
    }
}

//*** Andere kleine Testimonials sollen angezeigt werden ***
function testimonial2scroll(listCount, backwards) {
    var name;
    var imagepath;
    var j;
    for (var i = 0; i < listCount; i++) {
        name = "testimonial2-thumbnail" + i;
        if (backwards)//*** links geklickt ***
        {
            j = i - 1 + imageNumberAdd;
            if (j < 0) {
                j = j + imagelistSmall.length;
            }
            if (j >= imagelistSmall.length) {
                j = j - imagelistSmall.length;
            }

            imagepath = imagelistSmall[j].src;
        }
        else//*** rechts geklickt ***
        {
            j = i + 1 + imageNumberAdd;
            if (j >= imagelistSmall.length) {
                j = j - imagelistSmall.length;
            }
            imagepath = imagelistSmall[j].src;
        }

        //alert(name + " : " + imagepath);

        document.getElementById(name).src = imagepath;
    }

    if (backwards)//*** links geklickt ***
    {
        imageNumberAdd--;
        if (imageNumberAdd < 0)
            imageNumberAdd = imagelistSmall.length - 1;
    }
    else//*** rechts geklickt ***
    {
        imageNumberAdd++;
        if (imageNumberAdd >= imagelistSmall.length)
            imageNumberAdd = 0;
    }
}

//*** Das große Testimonial Bild soll angezeigt werden ***
function testimonial2showimage(imageID, imageNumber) {
    var j = imageNumber + imageNumberAdd;
    if (j >= imagelistSmall.length)
        j = j - imagelistSmall.length;

    //alert(divName + " : " + imageNumber + " - " + j + " - " + imageNumberAdd)

    var imagepath = imagelistLarge[j].src;

    var image = document.getElementById(imageID);
    if (image != null) {
        image.src = imagepath;
        image.style.display = "block";
    }
}