<!-- BEGIN site/status.tt -->
    [% IF c.authen.username # don't do this if logged / timed out %]
        [% # PROCESS site/js/jquery.tt # already loaded in html_wrapper %]
        <script language="javascript" type="text/javascript">
        setInterval("seek_new_message()", 10 * 60 * 1000); // 10 mins - in millisecs
        function seek_new_message() { 
            $('#notify').load('/script/cgi/new_messages.cgi?username=[%
                c.authen.username %];tt=[% template.name %];url=[% app_url %]')
        }
    </script>
    <div id="notify" style="text-align: center"></div>
    [% END %]
    
    [% IF c.stash.status_msg %]
        <p class="message">[% c.stash.status_msg %]</p>
    [% END %]

    [% IF c.stash.error_msg %]
        <p class="error">ERROR: [% c.stash.error_msg %]</p>
    [% END %]

    [% IF using_cap_flash; # using MessageStack instead & disabled to prevent c.flash producing undef msgs
        # PROCESS dumper.tt dump = c.flash.dump;    
        # FOREACH type IN [ 'info', 'warning', 'error' ];
            # IF c.flash.has_key(type);
                # FOREACH message IN c.flash.get(type) -%]
                <p class="[% type %]">
                    [% type | upper %]: [% message %]
                </p>
                [% # END %]
            [% # END %]
        [% # END %]
    [% END %]

    [% # CAP::MessageStack: # PROCESS dumper.tt dump = CAP_Messages %]    
    [% FOREACH CAP_Messages %]
        [% NEXT UNLESS
            class.match('info')  ||
            class.match('error') ||
            class.match('warning') # any others handled in local templates
        %]
        <p class="[% class %]">
            [% class | upper %]: [% message %]
        </p>
    [% END %]
<!-- END site/status.tt -->
