jQuery(function() {
    
    $('#langselector li:first a').css('backgroundImage', 'none');
    $('#langselector li').each(function() {
        $(this).css('display', 'block');
    });
    
    var timeout = 10000;
    var min = 0;
    var max = $('#comments div.content').length-1;
    var rand = rand_between(min, max);

    function rand_between(min, max) {
        if (min > max) {
            return(-1);
        }
        if(min == max) {
            return(min);
        }
        return min + parseInt(Math.random() * (max-min+1));
    }

    function showOther() {
        var elem = $('#comments div.content:visible');
        var next = elem.next();

        if (next.length == 0) {
            next = $('#comments div.content:first');
        }

        elem.fadeOut('fast', function() {
            next.fadeIn('fast');
        })

        setTimeout(showOther, timeout);
    }

    $('#comments div.content').eq(rand).removeClass('hide').show();
    setTimeout(showOther, timeout);

});
