<tmpl_var footerpluginoutput escape="none">

<center>
  <br><a href="http://www.openwebmail.org" target="_blank"><tmpl_var programname escape="html"></a> version <tmpl_var programversion escape="html">&nbsp;&nbsp;<a accesskey="H" href="<tmpl_var url_help escape="none">" target="_help">Help?</a>
</center>

<tmpl_if remainingseconds>
<script type="text/javascript">
<!--
   // alert before session end
   var remainingseconds = <tmpl_var remainingseconds escape="js">;
   var warn = 0;
   var timer;

   function timeoutcheck () {
      remainingseconds = remainingseconds - 1;
      if (remainingseconds > 0) {
         // check again every second
         timer = setTimeout("timeoutcheck()", 1000);

         if (remainingseconds < 65) {
            if (remainingseconds >= 5) {
               window.defaultStatus = "session time : " + (remainingseconds - 5) + " seconds left";
            }
            if (!warn) {
               warn = 1;
               // @@@JSCODE@@@ goes here someday
               var timeoutwarningpopup = window.open('<tmpl_var url_cgi escape="none">/openwebmail-prefs.pl?action=timeoutwarning&sessionid=<tmpl_var sessionid escape="url">&session_noupdate=1',"_timeoutwarning","width=400,height=140,resizable=no,scrollbars=no");
               timeoutwarningpopup.focus();
            }
         }
      } else {
         window.defaultStatus = "session timeout";
         clearTimeout(timer);
      }
   }

   function sessioncheck () {
      if (remainingseconds > 0) {
         return true;
      } else {
         alert("Sorry, your session has timed out, please login again.");
         return false;
      }
   }

   timeoutcheck();
//-->
</script>
</tmpl_if>

</body>
</html>
