$(function() {
    $("#navigation a").wrapInner("<span/>");
    $("#navigation a span").dropShadow({
        top: 0.5,
        left: 0.5,
        blur: 1
    });
    $("#links li a").mouseover(function() {
        $(this).fadeOut("fast").fadeIn("fast").css({ color: "#BB4" });
    });
    $("#links li a").mouseout(function() {
        $(this).css({ color: "#DCE" });
    });

    // Flash messages
    Flash.transferFromCookies();

    // -- Popup
    Flash.writeDataTo('popup', $('#popup .inner'));
    if ($('#popup .inner').html() != "") {
        $('#popup').show().dialog({
            title: 'Important Message',
            modal: true,
            resizable: false,
            height: 'auto',
            width: 450
        });
    }

    // -- Notice
    Flash.writeDataTo("notice", $("div.flash .notice"));
    Flash.writeDataTo("error", $("div.flash .error"));
    $("div.flash h4").each(function() {
        var element = this;
        if ($(element).html() != "") {
            $(element).slideDown("slow");
            window.setTimeout(function() { $(element).slideUp("slow"); }, 6000);
        }
    });
    $(".custom-button").hover(function() {
        $(this).addClass('ui-state-hover');
    }, function() {
        $(this).removeClass('ui-state-hover');
    });
});
