{{use "jquery"}}
{{use "pnotify"}}
<script type="text/javascript">
var show_message = function(message, category){
    $.pnotify({
        //pnotify_title: 'Regular Notice',
        pnotify_history: false,
        pnotify_text: message,
        pnotify_type: category || 'success',
        pnotify_animation: 'slide',
        pnotify_before_open: function(pnotify){
           // Position this notice in the center of the screen.
           pnotify.css({
               "top": 1,
               "left": (top.$(window).width() / 2) - (pnotify.width() / 2)
           });
        }
    });
}

$(function(){
    {{for category, message in get_flashed_messages():}}
        show_message('{{=message}}', '{{=category}}');
    {{pass}}
});
</script>
