<%@ page buffer="8kb" autoFlush="true" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="zm" uri="com.zimbra.zm" %>
<%@ taglib prefix="mo" uri="com.zimbra.mobileclient" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="com.zimbra.i18n" %>
<zm:getMailbox var="mailbox"/>
<c:set var="app" value="${empty param.st ? mailbox.prefs.groupMailBy : param.st}"/>
<c:if test="${( app eq 'message' || app eq 'conversation' || app eq 'folders' || app eq 'newmail') && not mailbox.features.mail}">
    <c:set var="app" value="contact"/>
</c:if>
<c:if test="${(app eq 'contact' || app eq 'ab' || app eq 'newcontact') && not mailbox.features.contacts}">
    <c:set var="app" value="cal"/>
</c:if>
<c:if test="${(app eq 'cal' || app eq 'newappt' || app eq 'appointment' || app eq 'cals') && not mailbox.features.calendar}">
    <c:set var="app" value="tasks"/>
</c:if>
<c:if test="${(app eq 'tasks' || app eq 'newtask' || app eq 'tasks') && not mailbox.features.tasks}">
    <c:set var="app" value="notebooks"/>
</c:if>
<c:if test="${(app eq 'notebooks' || app eq 'notebook' || app eq 'wiki') && not mailbox.features.notebook}">
    <c:set var="app" value="briefcases"/>
</c:if>
<c:if test="${(app eq 'briefcases' || app eq 'briefcase')  && not mailbox.features.briefcases}">
    <c:set var="app" value="?"/>
</c:if>
<c:choose>
    <c:when test="${app eq 'versions'}">
        <c:import url="/m/moversions"/>
    </c:when>

    <c:when test="${app eq 'newmail' || param.action eq 'compose'}">
             <c:import url="/m/mocompose"/>
    </c:when>

    <c:when test="${app eq 'newappt' or app eq 'newtask'}">
         <c:import url="/m/moapptcompose?st=${app}"/>
    </c:when>

    <c:when test="${app eq 'message' || app eq 'conversation' || app eq 'contact' || app eq 'briefcase' || app eq 'wiki' || app eq 'task' || app eq 'gal'}">
         <c:import url="/m/mosearch?st=${app}"/>
    </c:when>

    <c:when test="${app eq 'cal'}">
         <c:import url="/m/mocalendar"/>
    </c:when>

    <c:when test="${app eq 'cals'}">
         <c:import url="/m/mocals"/>
    </c:when>

    <c:when test="${app eq 'query'}">
         <c:import url="/m/moquery"/>
    </c:when>

    <c:when test="${app eq 'folders'}">
         <c:import url="/m/mofolders"/>
    </c:when>

    <c:when test="${app eq 'moveto'}">
         <c:import url="/m/momoveto"/>
    </c:when>
    
    <c:when test="${app eq 'tasks'}">
         <c:import url="/m/motasks"/>
    </c:when>

    <c:when test="${app eq 'briefcases' || app eq 'notebooks'}">
         <c:import url="/m/mobriefcases"/>
    </c:when>

    <c:when test="${app eq 'ab'}">
         <c:import url="/m/moaddrbooks"/>
    </c:when>
    <c:when test="${app eq 'prefs'}">
         <c:import url="/m/moprefs"/>
    </c:when>
    <%--<c:when test="${app eq 'zdocs'}">--%>
        <%--<zm:getDocument var="document" id="${zm:cook(param.id)}"/>--%>
        <%--<mo:displayZDoc document="${document}" mailbox="${mailbox}"/>--%>
    <%--</c:when>--%>
</c:choose>