{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if ( is_array( $mOption ) && in_array( $sOption@key, $mOption ) ) || ( $sOption@key == $mOption )}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

<script type="text/javascript">
	$(document).ready(function(){
		$("form#user-form").validate();
		$("form#user-form #user-login").rules("add", {required: true});

		{{if isset( $smarty.get.activeTabId )}}$('ul.tab-headers li a[href="#{{$smarty.get.activeTabId}}"]').trigger('click');{{/if}}
	});
</script>
<form action="?p={{$_GET.p}}&amp;iUser={{$aUser.iUser}}" method="post" id="user-form" > 
	<fieldset class="tabbed">
		<div class="clear"></div>
		<ul class="tab-headers">
			<li><a href="#user-info">{{$lang.User}}</a></li>
			<li><a href="#smartoffer-user-pages"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_pages}}</a></li>
			<li><a href="#smartoffer-user-products"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_products}}</a></li>
			<li><a href="#smartoffer-user-basket"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_basket}}</a></li>
			<li><a href="#smartoffer-user-storage"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_storage}}</a></li>
			<li><a href="#smartoffer-user-compare"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_compare}}</a></li>
			<li><a href="#smartoffer-user-filter"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_filter}}</a></li>
			<li><a href="#smartoffer-user-searched"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_searched}}</a></li>
			<li><a href="#smartoffer-user-advsearcher"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.smartoffer_advsearcher}}</a></li>
			<li><a href="#smartoffer-user-avail_newsletter"><span class="smartoffer"><strong>smart</strong>offer</span><br/>{{$lang.Avail_newsletter}}</a></li>
		</ul>
		<h1>{{$lang.User}} - {{if isset( $aUser.sFirstName )}}{{$aUser.sFirstName}} {{$aUser.sLastName}}{{else}}{{$lang.New}}{{/if}}</h1>
		<div class="tab" id="user-info">
			<input type="hidden" name="iUser" value="{{$aUser.iUser}}" />
			<input type="hidden" name="sLoginOld" value="{{$aUser.sLogin}}" />
			<div class="block50">
				<table class="details">
					<tr>
						<th class="name">{{$lang.Login}}</th><td class="value"><input id="user-login" type="text" name="sLogin" value="{{$aUser.sLogin}}" size="30" maxlength="30" class="input" alt="simple" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Password}}</th><td class="value"><input id="user-password" type="text" name="sPass" value="" size="30" maxlength="30" class="input" alt="simple" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.First_name}}</th><td class="value"><input id="user-first-name" type="text" name="sFirstName" value="{{$aUser.sFirstName}}" size="30" maxlength="20" class="input" alt="simple" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Last_name}}</th><td class="value"><input id="user-last-name" type="text" name="sLastName" value="{{$aUser.sLastName}}" size="30" maxlength="30" class="input" alt="simple" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Company}}</th><td class="value"><input type="text" name="sCompanyName" value="{{$aUser.sCompanyName}}" size="30" maxlength="100" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Nip}}</th><td class="value"><input type="text" name="sNip" value="{{$aUser.sNip}}" size="30" maxlength="40" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Street}}</th><td class="value"><input type="text" name="sStreet" value="{{$aUser.sStreet}}" size="30" maxlength="40" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Zip_code}}</th><td class="value"><input type="text" name="sZipCode" value="{{$aUser.sZipCode}}" size="30" maxlength="20" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.City}}</th><td class="value"><input type="text" name="sCity" value="{{$aUser.sCity}}" size="30" maxlength="40" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Country}}</th><td class="value"><select name="iCountry" class="select"><option value="0">{{$lang.Select}}</option>{{selectOptions aOptions=$aCountries mOption=$aUser.iCountry}}</select></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Phone}}</th><td class="value"><input id="user-phone" type="phone" name="sPhone" value="{{$aUser.sPhone}}" size="30" maxlength="20" class="input" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Email}}</th><td class="value"><input id="user-email" type="text" name="sEmail" value="{{$aUser.sEmail}}" size="30" maxlength="60" class="input" alt="simple" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.Status}}</th><td class="value"><input name="iStatus" type="hidden" value="0" /><input name="iStatus" type="checkbox"{{if $aUser.iStatus}} checked="checked"{{/if}} value="1" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.send_forum_notify_user_email}}</th><td class="value"><input name="iForumNotifyEmail" type="hidden" value="0" /><input name="iForumNotifyEmail" type="checkbox"{{if $aUser.iForumNotifyEmail}} checked="checked"{{/if}} value="1" /></td><td class="help"></td>
					</tr><tr>
						<th class="name">{{$lang.send_forum_notify_user_sms}}</th><td class="value"><input name="iForumNotifySMS" type="hidden" value="0" /><input name="iForumNotifySMS" type="checkbox"{{if $aUser.iForumNotifySMS}} checked="checked"{{/if}} value="1" /></td><td class="help"></td>
					</tr>
				</table>
			</div>
			<div class="block50">
				<h2>{{$lang.Groups_related}}</h2>
				<table id="groups-multiselect" class="multiselect list">
					<thead>
						<tr><th class="id">{{$lang.Id}}</th><th class="name">{{$lang.Name}}</th><th class="actions">{{$lang.Actions}}</th></tr>
						<tr class="item" style="display: none">
							<td class="id">%iId%</td>
							<td class="name">%sName%</td>
							<td class="actions"><a class="groups-delete" href="#" ><img src="{{$config.dir_templates}}admin/images/ico/delete.png" alt="{{$lang.Delete}}" title="{{$lang.Delete}}"/></a></td>
							<td class="value" style="display: none"><input type="hidden" value="%iId%" name="aGroupsRelated[]" /></td>
						</tr>
					</thead>
					<tbody>
						{{foreach from=$aUser.aGroupsSelected item=iGroupSelected}}
							<tr class="item"><td class="id">{{$iGroupSelected}}</td><td class="name"> {{$aGroups[$iGroupSelected]}}</td><td class="del"><a class="groups-delete" href="#" ><img src="{{$config.dir_templates}}admin/images/ico/delete.png" alt="{{$lang.Delete}}" title="{{$lang.Delete}}"/></a></td><td class="value" style="display: none"><input type="hidden" value="{{$iGroupSelected}}" name="aGroupsRelated[]" /></td></tr>
						{{/foreach}}
					</tbody>
					<tfoot>
						<tr><td></td><td colspan="2"><a href="admin.php?p=users-groupMultiselect&amp;request_type=groups-multiselect" class="groups-select new_element">{{$lang.Add_related_groups}}</a></td></tr>
					</tfoot>
				</table>
			</div>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-pages">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-pages">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-products">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-products">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-basket">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-basket">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-storage">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-storage">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-compare">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-compare">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-filter">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-filter">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-searched">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-searched">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-advsearcher">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-advsearcher">{{$lang.Loading}}</a>
		</div>

		<div class="tab smartoffer" id="smartoffer-user-avail_newsletter">
			<a class="loader" href="?p=users-form&amp;iUser={{$aUser.iUser}}&amp;tab=smartoffer-user-avail_newsletter">{{$lang.Loading}}</a>
		</div>

		<div class="save float">
			<div class="save floatcontainer"><input type="submit" class="submit" value="&laquo; {{$lang.return}}"  onclick="location.href = '?p=users-list'; return false;"> <input type="submit" value="{{$lang.Save}} &raquo;" name="sOption" class="submit" /></div>
		</div>

	</fieldset>
</form>