function    bookmark() {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        window.external.AddFavorite(document.location.href, document.title);
    }
    else {
        window.sidebar.addPanel(document.title, document.location.href, '');
    }
}

function    input_prefill(input, value) {
    $(input).attr('value', value);

    $(input).focus(function() {
        if ($(this).attr('value') == value) {
            $(this).attr('value', '');
        }
    });
    $(input).blur(function() {
        if ($(this).attr('value') == '') {
            $(this).attr('value', value);
        }
    });
}

$(document).ready(function() {
    input_prefill('#login_user', 'Nom utilisateur');
    input_prefill('#login_pass', '********');

    var i = 0;
    $('#nav>li').each(function() {
        this.style.margin = 0;
        this.style.padding = 0;
        this.style.height = '25px';

        var a = $(this).children('a');
        var text = a.text();

        a.text('');
        a.append(
            '<img src="/image/nav/' +
            i +
            '.png" alt="' +
            text +
            '" />'
        );

        i += 1;
    });

    $('#nav>li').hover(
        function() {
            var img = $(this).find('img');
            var src = img.attr('src').replace('/image/nav/', '/image/nav/on/');
            img.attr('src', src);

            var ul = $(this).find('ul');
            //ul.slideDown('fast');
            ul.fadeIn(200);
        },
        function() {
            var img = $(this).find('img');
            var src = img.attr('src').replace('/image/nav/on/', '/image/nav/');
            img.attr('src', src);

            var ul = $(this).find('ul');
            //ul.slideUp(300);
            ul.fadeOut(400);
        }
    );

    //FIXME: do not do this
    $('a.external').click(function() {
       window.open(this.href);
       return false;
    });

    $("#content div.participant h3:first").addClass("active");
    $("#content div.participant div:not(:first)").hide();
    $("#content div.participant h3").click(function() {
        $(this).next("div").slideToggle("slow")
            .siblings("div:visible").slideUp("slow");
        $(this).toggleClass("active");
        $(this).siblings("h3").removeClass("active");
    });
});
