
function moveRight(id,k,option) {
    new Effect.Move(id,{ x:+1300, y:0, mode:'absolute', queue:'front', afterFinish:function(){    new Effect.Opacity(id,{from: 1, to: 0, duration: 0, afterFinish:function(){new Effect.Move(id,{ x:-1300, y:0, duration: 0, mode:'absolute', afterFinish:function(){new Effect.Opacity(id,{from: 0, to: 1, duration: 0, afterFinish:function(){fill(k,option)}})}})}})}});

}

function moveLeft(id,k,option) {
    new Effect.Move(id,{ x:-1300, y:0, mode:'absolute', queue:'front', afterFinish:function(){    new Effect.Opacity(id,{from: 1, to: 0, duration: 0, afterFinish:function(){new Effect.Move(id,{ x:+1300, y:0, duration: 0, mode:'absolute', afterFinish:function(){new Effect.Opacity(id,{from: 0, to: 1, duration: 0, afterFinish:function(){fill(k,option)}})}})}});
}});

}
function ShowIt(id) {
    new Effect.Move(id,{x:0, y:0, mode:'absolute', queue: 'end'});
    }
function fillcontent(option) {
    var counter=$('counterKasten').innerHTML;
    // Variablen in Zahlen umwandeln
    counter=1*counter;
    var k=1*k;
    var contentSize=1*contentSize
    if (option=="begin") {
        var k=1; 
        fill(k,option);
    }
    if (option=="for") {
        var k=counter+3; 
        //puffIt('id',k,option);
        moveRight('articles',k,option);
}
    if (option=="rewind") {
        var k=counter-3; 
        moveLeft('articles',k,option);
    }
}
function fill(k,option) {
    var i=1*i;
    var z=1*z;
    var y=1*y;
    $('counterKasten').update(k);
    var y=k+3;
    var i=y-2;
    var z=1;
    for (i; i<=y; i++) {
        if (content[i] != null) {  
            var kaststring="<span class=\"title\"><a href=" + link[i] + ">" + title[i] + "</a></span>" + content[i];
            var kastid='kasten'+z;
            $(kastid).update(kaststring);
            z++;
        }
        else {
            fillcontent('begin');
        }
     }
    ShowIt('articles')
}
