<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%--
  ~ This file is part of DebGen Biobank Software developed by ASTRID Research.
  ~ All rights reserved. Reproduction, modification, use or disclosure
  ~ to third parties without express authority is forbidden.
  ~
  ~ Copyright ASTRID Research Inc., Hungary, 2009-2011.
  ~
  ~ ASTRID Research
  ~ Headquaters: Csapo utca 42. Debrecen H-4029 HUNGARY
  ~ Phone: +36-52-533-173        Fax: +36-52-533-174
  ~ Web: http://www.astrid.hu    E-mail: info@astrid.hu
  ~
  ~ Project name: DebGen Biobank Software project.
  ~ URLS:
  ~ Developers: Istvan Zoltan Nagy (istvan.nagy@astrid.hu)
  --%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<jsp:useBean id="actionParameter" scope="request"
             class="hu.astrid.debgen.server.requestprocessor.ActionParameter"
             type="hu.astrid.debgen.server.requestprocessor.ActionParameter"/>

<jsp:useBean id="applicationData" scope="page" class="hu.astrid.debgen.server.startup.ApplicationParameters"/>
<fmt:setLocale value="${empty user ? applicationData.isoCode : user.languageCode}" scope="session"/>
<html>
    <head>
        <title><fmt:message key="${applicationData.thisApplicationName}" /></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" media="all" href="stylesheet/debgen.css">
        <link type="text/css" href="stylesheet/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
        <script type="text/javascript" src="javascript/custom-form-elements.js"></script>
        <!--script type="text/javascript" src="http://www.google.com/jsapi"></script-->
        <script type="text/javascript" src="javascript/jquery-1.3.1.min.js"></script>
        <script type="text/javascript" src="javascript/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="javascript/jquery.timers.js"></script>
        <script type="text/javascript" src="javascript/ui.core.js"></script>
        <script type="text/javascript" src="javascript/ui.dialog.js"></script>
        <script type="text/javascript" src="javascript/ui.draggable.js"></script>
        <script type="text/javascript" src="javascript/ui.resizable.js"></script>
        <script type="text/javascript" src="javascript/session.timeout.js"></script>
        <script type="text/javascript" src="javascript/jquery.form.js"></script>
        <script type="text/javascript">
            /* Session timeout prevention settings */
            var popupTime    = 1200;  //time of popup after pageload in seconds
            var sessionTime  = 1800; //length of session in seconds
            var elapsed      = 0;   //length of session in seconds

            //google.load("jquery", "1");
            $(document).ready(function(){
                ${not empty user ? "startTimer(sessionTime);" : ""}

                autocompleteOff();
                /*$("#patientName").autocomplete("autocompletename.html");
                $("#tajNumber").autocomplete("autocompletetaj.html");
                $("#patientCode").autocomplete("autocompletecode.html");*/
            });

            //Use this function to set the document title.
            function setWebTitle(title) {
                document.title = '<fmt:message key="${applicationData.thisApplicationName}" /> | ' + title;
            }

            function autocompleteOff() {
                var inputElements = document.getElementsByTagName("input");
                for (i=0; inputElements[i]; i++) {
                    if (inputElements[i].name != "username") {
                        inputElements[i].setAttribute("autocomplete","off");
                    }
                }
            }

            autocompleteOff();

        </script>
        <!--script type="text/javascript" src="javascript/jquery.autocomplete.js"></script-->
    </head>
    <body>
        <div style="display: none">
            <div id="dialog-confirm" title='<fmt:message key="preventTimeout" />'>
                <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><fmt:message key="sessionTimeout" /> <span id="popupRemaining"></span>.<br /> <fmt:message key="renewTimeout" /></p>
            </div>
            <div id="dialog-toolate" title='<fmt:message key="timedOut" />'>
                <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><fmt:message key="sorryTimedOut" /></p>
            </div>
            <!--You can see the remaining time here-->
            <div id="remaining"></div>
        </div>
        <!--Form to submit, to reset timer and the session-->
        <form id="noop" name="noopForm" action="noop">
            <input name="noop" value="please" type="hidden" />
        </form>

        <!--div class="applicationtitle">
            <table style="height: 51px; " align="center" border="0" cellspacing="0" cellpadding="0">
                <tbody>
                    <tr>
        <c:if test="${empty user}">
            <td class="separator"></td>
            <td class="inactivemenu" onmousemove="className='activemenu';" onmouseout="className='inactivemenu';">
                <a class="menulink" href="http://www.astrid.hu" target="_blank">LIMS is created by AstridResearch Inc.</a>
            </td>
            <td class="separator"></td>
        </c:if>
    </tr>
</tbody>
</table>
</div-->
    <c:if test="${not empty user}">
        <div style="position: absolute; left: 100px; top: 15px; height: 80px">
            <table cellspacing="5" cellpadding="0" style="border: 0px;">
                <tbody>
                    <tr>
                        <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                            <a class="topmenulink" href="index.html"><img style="vertical-align: middle; border: none;" src="pics/icons/home_24.png" width="24" height="24" alt="Menu"/><br /><fmt:message key="MENU" /></a>
                        </td>
                        <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                            <a class="topmenulink" href="myprofile.html"><img style="vertical-align: middle; border: none;" src="pics/icons/profile_24.png" width="24" height="24" alt="Profile"/><br /><fmt:message key="SAJÁT_PROFIL" /></a>
                        </td>
                <c:if test="${user.userAdministrator}">
                    <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                        <a class="topmenulink" href="listusers.html"><img style="vertical-align: middle; border: none;" src="pics/icons/users_24.png" width="24" height="24" alt="Users"/><br /><fmt:message key="FELHASZNÁLÓK" /></a>
                    </td>
                </c:if>
                <c:if test="${user.dataRecorder or user.researcher}">
                    <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                        <a class="topmenulink" href="listpatients.html"><img style="vertical-align: middle; border: none;" src="pics/icons/patients_24.png" width="24" height="24" alt="Patients"/><br /><fmt:message key="BETEGZ" /></a>
                    </td>
                    <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                        <a class="topmenulink" href="findpatient.html"><img style="vertical-align: middle; border: none;" src="pics/icons/find_24.png" width="24" height="24" alt="Search"/><br /><fmt:message key="KERES" /></a>
                    </td>
                </c:if>
                <td class="inactivetopmenu" onmousemove="className='activetopmenu';" onmouseout="className='inactivetopmenu';" align="center" valign="middle">
                    <a class="topmenulink" href="logout.html"><img style="vertical-align: middle; border: none;" src="pics/icons/exit.png" width="24" height="24" alt="Exit"/><br /><fmt:message key="KILÉPÉS" /></a>
                </td>
                <td valign="top">
                    <br />
                    <span class="logininfo"><i>&nbsp;${user.fullName} (${user.userName}) <fmt:message key="BEJELENTKEZVE" /></i></span>
                </td>
                </tr>
                </tbody>
            </table>
        </div>
    </c:if>
    <c:choose>
        <c:when test="${empty user}">
            <c:choose>
                <c:when test="${actionParameter.action eq 'forgottenpassword'}">
                    <%@include file="forgottenpassword.jsp" %>
                </c:when>
                <c:otherwise>
                    <%@ include file="login.jsp" %>
                </c:otherwise>
            </c:choose>
        </c:when>
        <c:when test="${not empty globalexception}">
            <%@include file="showerror.jsp" %>
        </c:when>
        <c:when test="${actionParameter.action eq 'changepassword'}">
            <%@include file="profile/changepassword.jsp" %>
        </c:when>
        <c:when test="${actionParameter.action eq 'savelanguage'}">
            <%@include file="profile/language.jsp" %>
        </c:when>
        <c:when test="${actionParameter.action eq 'language'}">
            <%@include file="profile/language.jsp" %>
        </c:when>
        <c:when test="${actionParameter.action eq 'myprofile'}">
            <%@include file="profile/myprofile.jsp" %>
        </c:when>
        <c:when test="${actionParameter.action eq 'showinformation'}">
            <%@include file="showinformation.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'useradmin'}">
            <%@include file="useradmin/users.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'patientmanager'}">
            <%@include file="patientmanager/patients.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'requestmanager'}">
            <%@include file="requestmanager/requests.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'samplemanager'}">
            <%@include file="samplemanager/samples.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'print'}">
            <%@include file="print/print.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'printmodule'}">
            <%@include file="print/print.jsp" %>
        </c:when>
        <c:when test="${actionParameter.scope eq 'modulemanager'}">
            <%@include file="modulemanager/modules.jsp" %>
        </c:when>
        <c:otherwise>
            <%@include file="welcome.jsp" %>
        </c:otherwise>
    </c:choose>
    <!--div class="copyright">
        &copy; 2009-2010 Astrid Research Inc.
    </div-->
    <c:if test="${param.debugMode eq 'true'}">
        <div class="debugdiv">
            <textarea rows="" cols="">${actionParameter}</textarea>
        </div>
    </c:if>
</body>
</html>
