// Shows and hides the message box marked with id="flash-message".

/*jslint white: true, onevar: true, browser: true, undef: true, nomen: false, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, strict: true, newcap: true, immed: true */
/*global jQuery, $, window*/

"use strict";

$(function () {
    var flash = $('#flash-message');
    var timeout = 1000 + 20 * flash.contents().text().length; // milliseconds

    flash
        .animate({opacity: 1.0}, timeout)
        .animate({opacity: 0.0}, 2000, function () {
            $(this).slideUp(500)
        })
        ;
});
