<%@ page errorPage="errorPage.jsp" language="java" session="true" contentType="text/html;charset=ISO-8859-2" %>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="com.etixpert.evolution.gui.servlets.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.etixpert.evolution.gui.servlets.*"%>
<%@ include file="header.jsp" %>
<%@ include file="check.jsp" %>
<%!
public String getVal(String name, HttpSession session) {
	Map m = (Map)session.getAttribute("distributor_search.jsp");
	if (m == null) return "";
	String[] vals = (String[])m.get(name);
	if (vals != null && vals.length>0 && vals[0] != null) return vals[0];
	return "";
}
%>
<%	
	if (request.getParameter("id_from")!=null) session.setAttribute("id_from", request.getParameter("id_from"));
	if (request.getParameter("id_to")!=null) {
		session.setAttribute("id_to", request.getParameter("id_to"));
	}

%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<link href="main.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- JavaScript code hiding
	function simpleLink(origLink) {
		parent.mainFrame.location = origLink;
	}


	function link(origLink){
		if (top.mainFrame.document.forms.length == 0) {
			simpleLink(origLink);
			return;
		}
		else {
			if (top.mainFrame.document.forms[0].saveState == null) {
				simpleLink(origLink); 
				return;
			}
			top.mainFrame.document.forms[0].saveState.value = top.mainFrame.self.location.pathname;
			top.mainFrame.document.forms[0].link.value = origLink;
			top.mainFrame.document.forms[0].submit();
		}
	}
// -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>
</head>
<body>
<jsp:include page="MenuHelper.jsp">
	<jsp:param name="self_id" value="none"/>
	<jsp:param name="parent_id" value="10100"/>	
</jsp:include>
<form action="process/distributor_search.jsp" method="post">
<input type="hidden" name="saveState"/>
<input type="hidden" name="link" value="process/distributor_search.jsp"/>
<input type="hidden" name="distID"/>
<input type="hidden" name="levelID"/>
<input type="hidden" name="pageAction">
<input type="hidden" name="cnr">
  <table width="800" border="0" cellpadding="0" cellspacing="0" id="userDetailsTable" class="normal">
    <!--DWLayoutTable-->
    <tr> 
      <td height="30" colspan="2" valign="top" id="userTableContentTitles"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td width="40">&nbsp;</td>
      <td colspan="4" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" colspan="2" valign="top" id="userTableContentTitles"><!--DWLayoutEmptyCell--><fmt:message key="ROOT_ID"/>:</td>
      <td width="40">&nbsp;</td>
      <td colspan="4" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="FROM"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input id="middle" type="text" name="id_from" value="<%=getVal("id_from", session)%>"></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><fmt:message key="TO"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><input id="middle" type="text" name="id_to" value="<%=getVal("id_to", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields">&nbsp;</td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value='distributor_list';link('process/distributor_search.jsp')"><fmt:message key="SEARCH"/></a></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
</tr>   
    <tr> 
      <td height="30" colspan="2" valign="top" id="userTableContentTitles"><!--DWLayoutEmptyCell--><fmt:message key="LASTNAME"/>:</td>
      <td width="40">&nbsp;</td>
      <td colspan="4" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="FROM"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input id="middle" type="text" name="name_from" value="<%=getVal("name_from", session)%>"></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><fmt:message key="TO"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><input id="middle" type="text" name="name_to" value="<%=getVal("name_to", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields">&nbsp;</td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value='distributor_list2';link('process/distributor_search.jsp')"><fmt:message key="SEARCH"/></a></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
</tr>
   <tr> 
      <td height="10" colspan="2" valign="top" id="userTableContentTitles"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td width="40">&nbsp;</td>
      <td colspan="4" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="EMAIL"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input id="long3" type="text" name="email" value="<%=getVal("email", session)%>"></td>
      <td></td>
      <td valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields">&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields">&nbsp;</td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value='distributor_list3';link('process/distributor_search.jsp')"><fmt:message key="SEARCH"/></a></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
	</tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="COMPANY"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input id="long3" type="text" name="company" value="<%=getVal("company", session)%>"></td>
      <td></td>
      <td valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields">&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles">&nbsp;</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields">&nbsp;</td>
      <td></td>
      <td valign="top" id="userTableContentTitles"><a href="javascript:top.mainFrame.document.forms[0].pageAction.value='distributor_list4';link('process/distributor_search.jsp')"><fmt:message key="SEARCH"/></a></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
	</tr>	
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="SORT_BY"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><select name="sorted_by">
      	<option value="id" <%="id".equals(getVal("sorted_by", session))?"selected":""%>><fmt:message key="ROOT_ID"/></option>
      	<option value="lastname" <%="lastname".equals(getVal("sorted_by", session))?"selected":""%>><fmt:message key="LASTNAME"/></option>
      	<option value="firstname" <%="firstname".equals(getVal("sorted_by", session))?"selected":""%>><fmt:message key="FIRSTNAME"/></option>
     	<option value="level_id" <%="level_id".equals(getVal("sorted_by", session))?"selected":""%>><fmt:message key="DISTRIBUTOR_TYPE"/></option>
      </select></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
      <td></td>
      <td valign="top" id="userTableContentTitles"></td>
</tr>       
  </table>
<table width="940" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr> 
    <td width="1120" height="30">&nbsp;</td>
  </tr>
  <tr>
    <td height="142" align="center" valign="top">
<div style="border-left: 0px gray solid; border-bottom: 0px gray solid;
            padding:0px; margin: 0px; width: 1040px;"> 
<table width="980" border="1" id="mainTable" align="left">
        <col width="100"><col width="180"><col width="100"><col width="180"><col width="180"><col width="50"><col width="100"><col width="130">
               <tr>
          <td id="accountTableHeaderContent"><fmt:message key="ID"/></td>
          <td id="accountTableHeaderContent"><fmt:message key="LASTNAME"/></td>
          <td id="accountTableHeaderContent"><fmt:message key="FIRSTNAME"/></td>
          <td id="accountTableHeaderContent"><fmt:message key="EMAIL"/></td>
          <td id="accountTableHeaderContent"><fmt:message key="COMPANY"/></td>
          <td id="accountTableHeaderContent"><fmt:message key="COUNTRY"/></td>
		  <td id="accountTableHeaderContent"><fmt:message key="DISTRIBUTOR_TYPE"/></td>
		  <td id="accountTableHeaderContent"><fmt:message key="DO_ORDER"/></td>
        </tr>
        </table></div>
      <DIV STYLE="overflow: auto; width: 1040px; height: 350px;
            border-left: 0px gray solid; border-bottom: 0px gray solid;
            padding:0px; margin: 0px">
        <table width="700" border="1" id="mainTable" align="left">
        <col width="100"><col width="180"><col width="100"><col width="180"><col width="180"><col width="50"><col width="100"><col width="130">
        <tr>
       <%= FormHelper.generateDistributorSearchRows(session)%>
       </tr></table></div>
      </td>
  </tr>
  <tr>
    <td height="78">&nbsp;</td>
  </tr>
</table>  
</form>
</body>
</html>
