
    var pag_eventi = 1;
    var switch_timer = 10000;
    function get_next_main_pp() {
        nextone = Number($("#main_pp_current").val())+1;
        if(!$("#main_pp_"+nextone).is("*"))
            nextone = 1;
        main_pp_scroller(nextone, false);
    }
    function main_pp_scroller (n, cycle){
            clearTimeout(main_pp_timer);
            $("#tolink_"+pag_eventi).removeClass("selected");
            $("#tolink_"+n).addClass("selected");
            $("#main_pp_current").val(n);
            $("#main_pp_"+pag_eventi).fadeOut("fast", function(){
                    $("#main_pp_"+n).fadeIn("fast");
            });
            pag_eventi = n;
            var next_pag = n+1;
            if(!$("#main_pp_"+next_pag).is("*"))
            next_pag = 1;
            if( cycle == true)
                    main_pp_timer = setTimeout("main_pp_scroller("+next_pag+", true)",switch_timer);
    }
    function mh (n)
    {
        $(".mh").removeClass("mh_h");
        $("#mh_"+n).addClass("mh_h");
        $(".bm").hide();
        $("#bm_"+n).show();
    }
    function home_video_back()
    {
        var k = ($("#video_counter").val());
        var next = parseInt(k)-1;
        if (next<0)
            next =4;
        $(".home_video_"+k).hide();
        $(".home_video_"+next).show();
        $("#video_counter").val(next);
        
    }
    function home_video_forw()
    {
        var k = ($("#video_counter").val());
        var next = parseInt(k)+1;
        if (next>4)
            next =0;
        $(".home_video_"+k).hide();
        $(".home_video_"+next).show();
        $("#video_counter").val(next);
    }
    
