var active = 1;
var run = false;
$(document).ready(function(){

    $("#btn-next").click(function(){
    
      if (!run)
        if (active+1 > 8) {
            run = true;
            
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {top:"0"} );
            $("#slide-bottom").css( {display:"block"} );
            $("#slide-bottom").animate({"top": "-=295px"}, "slow", function() { 
                                                                        $("#slide-bottom").css( {display:"none"} ); 
                                                                        $("#slide-bottom").css( {top:"295px"} ); 
                                                                        });
            $("#slides-list").animate({"top": "-=295px"}, "slow", function() { 
                                                                        $("#slides-list").css({"top": "0"});
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=1;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
        else {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").animate( {"top": "-=295px"}, "fast" );
            $("#slides-list").animate({"top": "-=295px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active+=1;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
            
        }
        
        
    });
    
    // END of next-button
    $("#btn-prev").click(function(){
    
      if (!run)
        if (active-1 < 1) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( "top", "-2065px" );
            $("#slide-top").css( {display:"block"} );
            $("#slide-top").animate({"top": "+=295px"}, "slow", function() { 
                                                                        $("#slide-top").css( {display:"none"} ); 
                                                                        $("#slide-top").css( {top:"-295px"} ); 
                                                                        });
            $("#slides-list").animate({"top": "+=295px"}, "slow", function() { 
                                                                        $("#slides-list").css({"top": "-2065px"});
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=8;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
        else {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").animate( {"top": "+=295px"} );
            $("#slides-list").animate({"top": "+=295px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active-=1;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    });
    // END of previouse-button
    
    
    $("#switcher01").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "0"} );
            $("#slides-list").animate({"top": "0"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=1;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher01
    
    $("#switcher02").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-295px"} );
            $("#slides-list").animate({"top": "-295px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=2;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher02
    
    $("#switcher03").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-590px"} );
            $("#slides-list").animate({"top": "-590px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=3;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher03
    
    $("#switcher04").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-885px"} );
            $("#slides-list").animate({"top": "-885px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=4;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher04
    
    $("#switcher05").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-1180px"} );
            $("#slides-list").animate({"top": "-1180px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=5;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher05
    
    $("#switcher06").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-1475px"} );
            $("#slides-list").animate({"top": "-1475px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=6;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher06
    
    $("#switcher07").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-1770px"} );
            $("#slides-list").animate({"top": "-1770px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=7;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher07
    
    $("#switcher08").click( function() {
        if (!run) {
            run = true;
            $("#slides-button-list").css( {display:"none"} );
            $("#slides-button-list").css( {"top": "-2065px"} );
            $("#slides-list").animate({"top": "-2065px"}, "slow", function() { 
                                                                        $("#slides-button-list").css( {display:"block"} );
                                                                        $("#switcher0"+active+" a").removeClass("act");
                                                                        active=8;
                                                                        run = false;
                                                                        $("#switcher0"+active+" a").addClass("act");
                                                                        });
        }
    }); // END of switcher08
});
