var maxiScrollOnoff = 1;

$(function () {
    //hlavne sekcie
    $('#sections > ul li.section').each(function (idx,el) {
        var classPrefix = 's' + (idx+1);
        $(el).hover(function () {
            $(this).addClass(classPrefix + '-hover');
        },function () {
            $(this).removeClass(classPrefix + '-hover');
        }).click(function () {
            $(this).addClass(classPrefix + '-active');
        });
    });
    $('#maxiscroller').hide();
    window.setTimeout(function () {
        $('#maxiscroller').show();
        MaxiScroll();
    },2200);
    // $('#maxiscrollerContent').hover(function () {
    //     maxiScrollOnoff = 0;
    // },function () {
    //     maxiScrollOnoff = 1;
    //     MaxiScroll();
    // });
    
    new01092010_hide();
});

function MaxiScroll(curLeft) {
    if (typeof(curLeft) == 'undefined') {
        var curLeft = parseInt($('#maxiscrollerContent').css('left'));
    }
    var newLeft = curLeft - 2;
    $('#maxiscrollerContent').css('left',newLeft + 'px');
    var firstW = $('#maxiscrollerContent span.maxipredmet:eq(0)').width();
    if (firstW + newLeft < 0) {
        newLeft += firstW;
        $('#maxiscrollerContent').css('left',newLeft + 'px');
        $('#maxiscrollerContent span.maxipredmet:eq(0)').appendTo($('#maxiscrollerContent'));
    }
    if (maxiScrollOnoff == 1) {
        window.setTimeout(function () {
            MaxiScroll(newLeft);
        },100);
    }
}

function new01092010_hide() {
    $('#new01092010').fadeOut('slow');
    window.setTimeout(new01092010_show,300);
}
function new01092010_show() {
    $('#new01092010').fadeIn('slow');
    window.setTimeout(new01092010_hide,2000);
}
