$(document).ready(function() {
    // Tagcloud
    $('div#tagcloud ul').tagcloud({
        'height': 75,
        'type': 'sphere'
    });

    // Accordion
    $('dd').hide();
    $('dt').click(
        function() {
            var checkElement = $(this).next();
            if (checkElement.is(':visible')) {
                checkElement.hide();
                return false;
            }

            var parent_node = $(this).parent();
            if (!checkElement.is(':visible')) {
                $('#' + parent_node.attr('id') + ' dd:visible').hide();
                checkElement.show();
                return false;
            }
    });

    // Random quote
    var rnd = Math.floor(Math.random() * quotes.length);
    $('#quote').append('<h2>Random quote</h2>');
    $('#quote').append('<p id="quotation">&quot;' + quotes[rnd]['q'] + '&quot;</p>');
    $('#quote').append('<p id="author"><span id="qdata">(' + (rnd+1) + '/' + (quotes.length+1) + ')</span> <span id="adata">&mdash;' + quotes[rnd]['a'] + '</span></p>');

    // Crash MSIE6.0
    $.crash();
});

