// Skripte zum Scrollen des Inhaltes auf der Startseite

var contentPosition = 0;
var contentItems = 0;
var contentDirectionRight = 0; // constant
var contentDirectionLeft = 1;  // constant
var contentDirection = 0;


function initalizeContentScript()
{
    var tables = document.getElementsByTagName("table");
    contentPosition = 0;
    contentItems = 0;
    contentDirection = contentDirectionRight;
    
    for(var i = 0; i < tables.length; i++)
    {
        if(tables[i].className == "startpage_bottom_content_item")
        {
            contentItems++;
        }
    }
    
    var Bild = new Image();
    Bild.src = "/img/head_nav_left.jpg";
}


function scrollContentOfStartpage(contentDivId, buttonId, imgId)
{
    var contentDiv = document.getElementById(contentDivId);
    var button = document.getElementById(buttonId);
    var img = document.getElementById(imgId);
    
    if(contentDirection == contentDirectionRight)
    {
        contentPosition++;
        contentDiv.style.left = (-240 * contentPosition) + "px";
        if(contentPosition >= (contentItems - 4))
        {
            contentDirection = contentDirectionLeft;
            button.innerHTML = "zur&uuml;ck";
            img.src = "/img/head_nav_left.jpg";
            img.alt = "zurück";
        }
    }
    else
    {
        contentPosition--;
        contentDiv.style.left = (-240 * contentPosition) + "px";
        if(contentPosition == 0)
        {
            contentDirection = contentDirectionRight;
            button.innerHTML = "weiter";
            img.src = "/img/head_nav_right.jpg";
            img.alt = "weiter";
        }    
    }
}

