<%@ 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 getTitleOptions(HttpSession session) throws Exception{
	StringBuffer sb = new StringBuffer("");
	Title[] titles = FormHelper.getTitles();
	
	for (int i = 0; i < titles.length; i++) {
		String selected="";
		if (getVal("titel_id", session).equals(titles[i].id)) selected=" selected";
		String vv = titles[i].value;
		if (titles[i].value==null) vv = "";
		sb.append("<option"+selected+" value=\""+ titles[i].id + "\">"+vv+"</option>");
	}
	return sb.toString();
}

public String getCountryOptions(HttpSession session) throws Exception{
	StringBuffer sb = new StringBuffer("");
	Country[] countries = FormHelper.getCountries();
	
	for (int i = 0; i < countries.length; i++) {
		String selected="";
		if (getVal("country_code", session).equals(countries[i].country_code)) selected=" selected";
		sb.append("<option"+selected+" value=\""+ countries[i].country_code + "\">"+countries[i].name+"</option>");
		
	}
	return sb.toString();
}

public String getLevelAddressOptions(HttpSession session) throws Exception {
	StringBuffer sb = new StringBuffer("");
	LevelAddress[] levelAddresses = FormHelperC.getLevelAddresses();
	
	for (int i = 0; i < levelAddresses.length; i++) {
		String selected="";
		if (getVal("level_address_id", session).equals(levelAddresses[i].id)) selected=" selected";	
		String vv = levelAddresses[i].value;
		if (vv==null) vv = "";
		sb.append("<option"+selected+" value=\""+ levelAddresses[i].id + "\">"+vv+"</option>");
	}
	return sb.toString();
}
	
public String getLanguages(HttpSession session) throws Exception {
	StringBuffer sb = new StringBuffer("");
	Language[] languages = FormHelper.getLanguages();
	
	for (int i = 0; i < languages.length; i++) {
		String selected="";
		if (getVal("language_id", session).equals(languages[i].id)) selected=" selected";
		sb.append("<option"+selected+" value=\""+ languages[i].id + "\">"+languages[i].value+"</option>");
	}
	return sb.toString();
}

public String getVal(String name, HttpSession session) {
	Map m = (Map)session.getAttribute("new_customer_detail_personal.jsp");
	if (m == null) return "";
	String[] vals = (String[])m.get(name);
	if (vals != null && vals.length>0 && vals[0] != null) return vals[0];
	return "";
}
%>
<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 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="#e6e6ee">
<table border="1" id="userTable" class="menu">
<jsp:include page="MenuHelper.jsp">
	<jsp:param name="self_id" value="2110"/>
	<jsp:param name="parent_id" value="2100"/>	
</jsp:include>
</table>
<form action="process/new_customer_detail_personal.jsp" method="post">
<input type="hidden" name="saveState"/>
<input type="hidden" name="link" value="process/new_customer_detail_personal.jsp"/>
  <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" valign="top" id="userTableContentTitles"><fmt:message key="COUNTRY"/>:</td>
      <td></td>
      <td colspan="2" valign="top" id="userTableContentFields"><select name="country_code">
          <%=getCountryOptions(session)%>
        </select></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"><fmt:message key="LEVEL_ADDRESS"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><select name="level_address_id"><%=getLevelAddressOptions(session)%>
        </select></td>
      <td valign="top" id="userTableContentTitles"><fmt:message key="TITLE"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><select name="titel_id"><%=getTitleOptions(session)%>
        </select></td>
    </tr>
    <tr>
      <td width="172" height="30" valign="top" id="userTableContentTitles"><fmt:message key="FIRSTNAME"/>:</td>
      <td width="30">&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input maxlength="25" type="text" name="firstname" value="<%=getVal("firstname", session)%>"></td>
      <td width="116" valign="top" id="userTableContentTitles"><fmt:message key="LASTNAME"/>:</td>
      <td width="26">&nbsp;</td>
      <td width="263" valign="top" id="userTableContentFields"><input type="text" maxlength="25" name="lastname" value="<%=getVal("lastname", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="COMPANY"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><input name="company" maxlength="50" type="text" id="comment" value="<%=getVal("company", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="BIRTHDATE"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input name="birthdate" maxlength="11" type="text" value="<%=getVal("birthdate", session)%>"></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"><fmt:message key="COUPLE_PARTNER"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><input maxlength="50" name="couple_partner" type="text" id="comment" value="<%=getVal("couple_partner", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="TEL1"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input type="text" maxlength="25" name="tel1" value="<%=getVal("tel1", session)%>"></td>
      <td valign="top" id="userTableContentTitles"><fmt:message key="TEL2"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><input type="text" maxlength="25" name="tel2" value="<%=getVal("tel2", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="MOBIL"/>:</td>
      <td>&nbsp;</td>
      <td colspan="2" valign="top" id="userTableContentFields"><input type="text" maxlength="25" name="mobil" value="<%=getVal("mobil", session)%>"></td>
      <td valign="top" id="userTableContentTitles"><fmt:message key="FAX"/>:</td>
      <td>&nbsp;</td>
      <td valign="top" id="userTableContentFields"><input type="text" maxlength="50" name="fax" value="<%=getVal("fax", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="EMAIL"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><input maxlength="50" name="email" type="text" id="comment" value="<%=getVal("email", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="WWW"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><input maxlength="50" name="www" type="text" id="comment" value="<%=getVal("www", session)%>"></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="LANGUAGE"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><select name="language_id"> <%=getLanguages(session)%>
        </select></td>
    </tr>
    <tr> 
      <td height="30" valign="top" id="userTableContentTitles"><fmt:message key="COMMENT"/>:</td>
      <td>&nbsp;</td>
      <td colspan="5" valign="top" id="userTableContentFields"><textarea rows="3" maxlength="255" name="comment" id="comment"><%=getVal("comment", session)%></textarea></td>
    </tr>
    <tr> 
      <td height="20">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td width="153">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
