<%@ page errorPage="errorPage.jsp" language="java" session="true" contentType="text/html;charset=ISO-8859-2" %>
<%@ page import="com.etixpert.evolution.gui.servlets.*"%>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="header.jsp" %>
<%@ include file="check.jsp" %>
<%!
public String getShippingOptions(HttpSession session) throws Exception{
	StringBuffer sb = new StringBuffer("");
	Shipping[] pms = FormHelper.getShippings();
	
	for (int i = 0; i < pms.length; i++) {
		String selected="";
		if ("2".equals(pms[i].id)) continue;
		if (getVal("shipping_id", session).equals(pms[i].id)) selected=" selected";
		sb.append("<option"+selected+" value=\""+ pms[i].id + "\">"+pms[i].value+"</option>");
	}
	return sb.toString();
}

public String getLevelOptions(HttpSession session) throws Exception{
	StringBuffer sb = new StringBuffer("");
	com.etixpert.evolution.gui.servlets.Level[] pms = FormHelperC.getInteressentLevels();
	
	for (int i = 0; i < pms.length; i++) {
		String selected="";
		if (getVal("level_id", session).equals(pms[i].id)) selected=" selected";
		sb.append("<option"+selected+" value=\""+ pms[i].id + "\">"+pms[i].value+"</option>");
	}
	return sb.toString();
}

public String getDistributorOptions(HttpSession session) throws Exception{
	StringBuffer sb = new StringBuffer("");
	DistributorMin[] pms = FormHelper.getDistMin_wp_od();
	
	for (int i = 0; i < pms.length; i++) {
		String selected="";
		if (getVal("sponsor", session).equals(pms[i].id)) selected=" selected";
		sb.append("<option"+selected+" value=\""+ pms[i].id + "\">"+pms[i].fullname+", "+pms[i].id+", "+pms[i].beraterArt+"</option>");
	}
	return sb.toString();
}


	
public String getVal(String name, HttpSession session) {
	Map m = (Map)session.getAttribute("new_interessent_detail_int.jsp");
	if (m == null) return "";
	String[] vals = (String[])m.get(name);
	if (vals != null && vals.length>0 && vals[0] != null) return vals[0];
	return "";
}

public String getChecked(String name, HttpSession session) {
	Map m = (Map)session.getAttribute("new_interessent_detail_int.jsp");
	if (m == null) return "";
	String[] vals = (String[])m.get(name);
	if (vals != null && vals.length>0 && vals[0] != null) return " checked";
	return "";
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="main.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- JavaScript code hiding
	function changeSel(which){
		window = open("leftMenu.jsp?sel="+which, "_self", "");
	}

	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>
</head>
<body bgcolor="#e6eee6">
<table border="1" id="userTable" class="menu">
<jsp:include page="MenuHelper.jsp">
	<jsp:param name="self_id" value="2630"/>
	<jsp:param name="parent_id" value="2600"/>	
</jsp:include>
</table>
<form action="process/new_interessent_detail_int.jsp" method="post">
<input type="hidden" name="saveState"/>
<input type="hidden" name="link" value="process/new_interessent_detail_int.jsp"/>
  <table width="800" border="0" cellpadding="0" cellspacing="0" id="userDetailsTable" class="normal">
    <!--DWLayoutTable-->
    <tr> 
      <td width="202" height="30" valign="top" id="userTableContentTitles"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td width="40">&nbsp;</td>
      <td width="558" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="DEACTIVED"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><input name="active" type="checkbox" class="checkbox" value="<%=getVal("active", session)%>"<%=getChecked("active", session)%>></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="INTERESSENT_TYPE"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><select name="level_id"><%=getLevelOptions(session)%>
        </select></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="ADVERTISED"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><textarea rows="3" maxlength="255" name="advertised" id="comment"><%=getVal("advertised", session)%></textarea></td>
    </tr>
    <tr> 
      <td height="89">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
