
var animateState = 0;
var index = 0;

function animate(){
//    if(navigator.appName == "Microsoft Internet Explorer"){
        if(animateState == 1){
            animateState = 0;
            $("#sticky").slideUp("slow", function(){
                setTimeout("animate()", 7000);
                stickyLaden(aId[index]);
                index = index + 1;
                if(index == aId.length){
                    index = 0;
                }
            });
        } else if(animateState == 0){
            animateState = 1;
            $("#sticky").slideToggle("slow", animate());
        }
 /*   } else {
        if(animateState == 1){
            animateState = 0;
            $("#sticky").fadeOut(1300, function(){
                setTimeout("animate()", 7000);
                stickyLaden(aId[index]);
                index = index + 1;
                if(index == aId.length){
                    index = 0;
                }
            });
        } else if(animateState == 0){
            animateState = 1;
            $("#sticky").fadeIn(1300, animate());
        }

    }*/
}

function stickyLaden(id){
    var http = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    var url = "ajax/stickyladen.php?id=" + id;
    http.open("GET", url, true);
    http.onreadystatechange = function(){
        if(http.readyState == 4){
            document.getElementById("sticky").innerHTML = http.responseText;
        }
    }
    http.send(null);
}
