<script language="javascript" type="text/javascript">
<!-- //
{include file="$incpath/other/validate_js.tpl"}
{literal}

$(document).ready(function() {
	var validator = $("#convert").validate(
	{ 
		rules: 
		{ 
			Vorname: {required: true},
			Nachname: {required: true},
			Benutzername: {required: true, remote: "index.php?do=user&sub=checkuserdata&ext={/literal}{$res->Benutzername|koobispecialchars}{literal}"},
			Strasse_Nr: {required: true},
			Postleitzahl: {required: true},
			Ort: {required: true},
			Email: {required: true,email:true, remote: "index.php?do=user&sub=checkuserdata&ext={/literal}{$res->Email}{literal}"}
		},
		messages: 
		{
			Email:{remote: jQuery.format("{/literal}{#Validate_usedMail#}{literal}")},
			Benutzername:{remote: jQuery.format("{/literal}{#Validate_usedUName#}{literal}")}
		},
			
		submitHandler: function() 
		{ 
			document.forms['convert'].submit();
		},
		
		success: function(label) 
		{
			label.html("&nbsp;").addClass("checked");
		}
	});
});

// -->
</script>   
{/literal}

<form method="post" action="" name="convert" id="convert">
<div class="popbox">
<div class="header">{#User_edit#}</div>
<div class="subheaders">{#User_convertGuestToUser#}</div>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="180" class="row_left">{#User_first#}</td>
    <td class="row_right"><input class="input" type="text" name="Vorname" value="{$res->Vorname|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_last#}</td>
    <td class="row_right"><input class="input" type="text" name="Nachname" value="{$res->Nachname|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_username#}</td>
    <td class="row_right"><input class="input" type="text" name="Benutzername" value="{$res->Benutzername|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_street#}</td>
    <td class="row_right"><input class="input" type="text" name="Strasse_Nr" value="{$res->Strasse_Nr|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_zip#}</td>
    <td class="row_right"><input class="input" type="text" name="Postleitzahl" value="{$res->Postleitzahl|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_town#}</td>
    <td class="row_right"><input class="input" type="text" name="Ort" value="{$res->Ort|koobispecialchars}"></td>
  </tr>
 <tr>
    <td class="row_left">{#User_country#}</td>
    <td class="row_right">
    <select class="input" style="width:130px" name="Land">
    {foreach from=$countries item=c}
    <option value="{$c->Code|lower}" {if $c->Code|lower==$res->LandCode|lower}selected="selected"{/if}>{$c->Name|koobispecialchars}</option>
    {/foreach}
    </select>    
    </td>
  </tr>
  <tr>
    <td class="row_left">{#User_phone#}</td>
    <td class="row_right"><input class="input" type="text" name="Telefon" value="{$res->Telefon|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_fax#}</td>
    <td class="row_right"><input class="input" type="text" name="Telefax" value="{$res->Telefax|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_company#}</td>
    <td class="row_right"><input class="input" type="text" name="Firma" value="{$res->Firma|koobispecialchars}"></td>
  </tr>
  <tr>
    <td class="row_left">{#User_ustid#}</td>
    <td class="row_right"><input class="input" type="text" name="UStId" value="{$res->UStId|koobispecialchars}"></td>
  </tr>
    <tr>
    <td class="row_left">{#User_email#}</td>
    <td class="row_right"><input class="input" type="text" name="Email" value="{$res->Email}"></td>
  </tr>
  
  
  <tr>
    <td class="row_left">{#User_ugroup#}</td>
    <td class="row_right">
    {if $smarty.session.benutzer_id!=$res->Id && $res->Id!=1}
    <select class="input" style="width:130px" name="Gruppe">
    {foreach from=$groups item=g}
    {if $g->Id!=2}<option value="{$g->Id}" {if $g->Id==$res->Gruppe}selected="selected"{/if}>{$g->Name_Intern|koobispecialchars}</option>{/if}
    {/foreach}
    </select>
    {else}
     <input type="hidden" name="Gruppe" value="{$res->Gruppe}" /><em>{#User_noChange#}</em>
   
    
    
  {/if}    </td>
  </tr>
  
  <tr>
    <td class="row_left">{#User_ugroupmisc#}</td>
    <td class="row_right">
    <select name="GruppeMisc[]" size="5" multiple="multiple" class="input" style="width:130px">
    {foreach from=$groups item=g}
    {if $g->Id!=2 && $g->Id!=1}
     <option value="{$g->Id}" {if in_array($g->Id,$res->GroupsM)}selected="selected"{/if}>{$g->Name_Intern|koobispecialchars}</option>{/if}
    {/foreach}
    </select>    </td>
  </tr>
  {if $res->Id!=1}
  <tr>
    <td class="row_left">{#User_sstatus#}</td>
    <td class="row_right">
     <label><input type="radio" name="Aktiv" value="1" {if $res->Aktiv==1}checked="checked"{/if} />Freigeschaltet</label>
    <label><input type="radio" name="Aktiv" value="0" {if $res->Aktiv==0}checked="checked"{/if} />Gesperrt</label>    </td>
  </tr>
  {/if}
  <tr>
    <td class="row_left">
    <img {popup sticky=$config_vars.POPSTICKY   text=$config_vars.User_markteamI} class="absmiddle" src="{$imgpath}/help.png" alt="" />
    
    {#User_team#}</td>
    <td class="row_right">
    <label><input type="radio" name="Team" value="1" {if $res->Team==1}checked="checked"{/if} />{#Yes#}</label>
    <label><input type="radio" name="Team" value="0" {if $res->Team==0}checked="checked"{/if} />{#No#}</label>    </td>
  </tr>
  
 
    <tr>
    <td class="row_left">{#User_newPass#}</td>
    <td class="row_right"><input class="input" type="text" name="Kennwort"></td>
  </tr>
    
    <tr>
      <td class="row_left">{#User_semail#}</td>
      <td class="row_right">
      <label><input name="send_mail" type="radio" id="send_mail" value="1" />{#Yes#}</label>
      <label><input name="send_mail" type="radio" value="0" checked="checked" />{#No#}</label>      </td>
    </tr>
    <tr>
      <td class="row_left">{#User_emailtext#}</td>
      <td class="row_right"><textarea name="mail_text" id="mail_text" class="input" style="width:300px; height:100px">{#User_profileChangeText#}</textarea></td>
    </tr>
</table>
<input class="button big" type="submit" name="button" value="{#Save#}">
<input class="button big" type="button" name="button" onclick="window.close();" value="{#Close#}">
<input name="save" type="hidden" id="save" value="1" />
</div>
</form>


{*
<script language="javascript" src="{$jspath}/calendar.js" type="text/javascript"></script>
<style type="text/css" media="screen,projection">
@import url({$csspath}/calendar.css);
</style>
<script type="text/javascript">
	jQuery(function($){ldelim}
	$.datepicker.setDefaults({ldelim}
	{include file="$incpath/other/calendar.conf.tpl"}
	,yearRange: '-50:+0'
	{rdelim}); 
	$("#Geburtstag").attachDatepicker();
	{rdelim});
</script>
*}
