<%@ page import="ro.emid.common.constants.AppConstants" %>

<%! private static boolean in(String value, String... values) {
    if (value == null) return false;
    if (values == null || value.length() == 0) return false;
    for (String s : values) {
        if (s != null && s.equals(value)) return true;
    }
    return false;
}%>


<%
    String selected = "";
    String _action = request.getParameter("action");

    if(in(_action, "alocare-localitati", "load-realocare-reclamatii", "realocare-reclamatii")) {
        selected = "1";
    }else if(in(_action, "localitati-nealocate")) {
        selected = "2";
    }else if(in(_action, "edit-alocare-localitate-ce", "edit-alocare-localitate-ce")) {
        selected = "3";
    }else if(in(_action, "sync-adr-history")) {
        selected = "4";
    }
%>

<ul class="menu">
    <li <%=selected.equals("1")?"class=\"selected\"":""%>>
        <a href="<%=AppConstants.APP_NAME%>?action=alocare-localitati">Localităţi alocate</a>
    </li>
    <li <%=selected.equals("2")?"class=\"selected\"":""%>>
        <a href="<%=AppConstants.APP_NAME%>?action=localitati-nealocate">Localităţi nealocate</a>
    </li>
    <li <%=selected.equals("3")?"class=\"selected\"":""%>>
        <a href="<%=AppConstants.APP_NAME%>?action=edit-alocare-localitate-ce">Alocare localitate</a>
    </li>
    <li <%=selected.equals("4")?"class=\"selected\"":""%>>
        <a href="<%=AppConstants.APP_NAME%>?action=sync-adr-history">Sincronizare nomenclator</a>
    </li>
</ul>

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery(".menu a").click(function(){
            jQuery(this).parent().addClass("selected");
        });
    });
</script>