$(window).load(function() {
    $('#loading').fadeOut('slow');
});

function slideSwitch() {
    var attiva = $('#slideshow a.attiva');

    //if ( attiva.length == 0 ) attiva = $('#slideshow img.inactive:next');

    var successiva = attiva.next().length ? attiva.next() : $('#slideshow a:first');

    attiva.addClass('disattiva');
    //attiva.removeClass('attiva');

    successiva.css({opacity: 0.0})
            .addClass('attiva')
            .removeClass('disattiva')
            .animate({opacity: 1.0}, 1000, function() {
        attiva.removeClass('attiva');
    });
}
$(function() {
    setInterval("slideSwitch()", 5000);
});
function hideRegistrazione() {
    $("#registrazioneUtente").hide('slow');
}
$(function() {
    $("#registrazioneUtente area").click(function() {
        $("#registrazioneUtente").hide('slow');
    });
    setInterval("hideRegistrazione()", 10000);
});

function notizieFlash() {
    var notiziaFlashIndex = 0;
    var notizie = $('span.notiziaFlash');
    if (notizie != null && notizie.length > 0) {
        if ($.cookie("notiziaFlashIndex") != null) {
            notiziaFlashIndex = $.cookie("notiziaFlashIndex") % notizie.length;
        }

        $('span.notiziaFlash:visible').fadeOut('slow', function() {
            notiziaFlashIndex = (notiziaFlashIndex + 1) % notizie.length;
            $('span.notiziaFlash').eq(notiziaFlashIndex).fadeIn('slow');
            $.cookie("notiziaFlashIndex", notiziaFlashIndex, { path: '/', expires: 1 });
        });
    }
}

$(function() {
    setInterval("notizieFlash()", 10000);
});

$(function() {
    $("div.notizia h1.titolo a").click(function() {
        $.cookie("lista-risultato", document.location.href);
    });
});




