{if $mode eq "edit"}
{include file="$gentemplates/_header.tpl" pagetitle="$edituser"}
{include file="$gentemplates/_navi.tpl" pagetitle="$edituser"}
{else}
{include file="$gentemplates/_header.tpl" pagetitle="$newuser"}
{include file="$gentemplates/_navi.tpl" pagetitle="$newuser"}
{/if}


<script language="javascript" type="text/javascript">

var err_no_username = "{$hashmap.nousername}";
var err_no_firstname = "{$hashmap.nofirstname}";
var err_no_lastname = "{$hashmap.nolastname}";
var err_pw_too_short = "{$hashmap.pwtooshort}";
var err_pws_not_equal = "{$hashmap.pwsnotequal}";
{literal}

function check_form() {
{/literal}
        checkpw = {if $mode eq "edit"}false{else}true{/if};
{literal}
	if (document.f1.usernameform.value.length == 0) {
		alert (err_no_username);
		document.f1.usernameform.focus();
		return false;
	} else if (document.f1.firstname.value.length == 0) {
		alert (err_no_firstname);
		document.f1.firstname.focus();
		return false;
	} else if (document.f1.lastname.value.length == 0) {
		alert (err_no_lastname);
		document.f1.lastname.focus();
		return false;
	} else if (checkpw && (document.f1.pw.value.length < 6)) {
		alert (err_pw_too_short);
		document.f1.pw.focus();
		return false;
	} else if (document.f1.pw.value != document.f1.pwagain.value) {
		alert (err_pws_not_equal);
		document.f1.pw.value = "";
		document.f1.pwagain.value = "";
		document.f1.pw.focus();
		return false;
	} else {
		 return true;
	}
}

</script>
{/literal}

<form name="f1" action="usermanager.php" method="POST" onsubmit="return check_form()">
<input type="hidden" name="{$SESSIONNAME}" value="{$SESSIONID}">
<input type="hidden" name="id" value="{$id}">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr><td class="lines2" height="2" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="2" hspace="0" vspace="0" border="0"></td></tr>						
  <tr align="left">
    <td class="tab" height="20"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="tab"><br /><span style="font-weight:bold;">{$errormsg}<br /></span></td>
    <td class="tab">&nbsp;</td>
  </tr>
  
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.usernametext}:</td>
    <td class="formhead">
      {if $mode=="edit"}
      <input type="hidden" name="usernameform" size="30" value="{$td.username}">
      {$td.username}
      {else}
      <input type="text" name="usernameform" size="30" value="{$td.username|escape:"html"}">
      {/if}</td>
  </tr>
    
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.firstname}:</td>
    <td class="formhead"><input type="text" name="firstname" size="30" value="{$td.firstname|escape:"html"}"></td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.lastname}:</td>
    <td class="formhead"><input type="text" name="lastname" size="30" value="{$td.lastname|escape:"html"}"></td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.birthday}:</td>
    <td class="formhead">
      {mgw_html_select_date prefix="birthday" start_year="-80" end_year="+0" time=$bdayts}
      {datepick form="f1" field="birthdayYear,birthdayMonth,birthdayDay"}
    </td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.sex}:</td>
    <td class="formhead">
      <input type="radio" name="sex" value="male" {if $td.sex eq 'male'} checked="checked"{/if} />{$hashmap.sexm}<br>
      <input type="radio" name="sex" value="female" {if $td.sex eq 'female'} checked="checked"{/if} />{$hashmap.sexf}</td>
  </tr>

  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.occupation}:</td>
    <td class="formhead">{$occupationbox|smarty:nodefaults}</td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.workloc}:</td>
    <td class="formhead">{$worklocbox|smarty:nodefaults}</td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.email}:</td>
    <td class="formhead"><input type="text" name="email" size="30" value="{$td.email|escape:"html"}"></td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.telephone}:</td>
    <td class="formhead"><input type="text" name="telephone" size="30" value="{$td.telephone|escape:"html"}"></td>
  </tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.mobile}:</td>
    <td class="formhead"><input type="text" name="mobil" size="30" value="{$td.mobil|escape:"html"}"></td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.pw}:</td>
    <td class="formhead"><input type="password" name="pw" size="30" value="{$td.pw|escape:"html"}"></td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.pwagain}:</td>
    <td class="formhead"><input type="password" name="pwagain" size="30" value="{$td.pw|escape:"html"}"></td>
  </tr>
  
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.initiallang}:</td>
    <td class="formhead">{$langbox|smarty:nodefaults}</td>
  </tr>
  
  {if $mode eq "new"}
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="30" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">{$hashmap.group}:</td>
    <td class="formhead">{$groupbox|smarty:nodefaults}</td>
  </tr>
  {/if}
  
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
  <tr align="left">
    <td class="tab" height="40"><img src="{$imgpathmaster}/space.gif" alt="" width="60" height="1" hspace="0" vspace="0" border="0"></td>
    <td class="formhead">&nbsp;</td>
    <td class="formhead"><input type="submit" name="{$suname}" value="{$hashmap.save}" class="{$suclass}"></td>
  </tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathmaster}/space.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td></tr>
</table>
  
</form>

{include file="$gentemplates/_footer.tpl" aktUser=$username}
