<script type="text/javascript">
	document.ready = function () {
		var sizelimit = {{ info_sizelimit }};
		if (sizelimit <= 0) {
			document.getElementById('sizelimit_text').style.display = "none";
		}
	}
	function validate_form() {
		var f = document.getElementById('profileForm');
		// Email
		var email = f.editmail.value;
		if ((email.length > 0) && (!emailCheck(email))) {
			alert("{{ lang.uprofile['wrong_email'] }}");
			return false;
		}
		// About
		var about = f.editabout.value;
		if (({{ info_sizelimit }} > 0) &&
		(about.length > {{ info_sizelimit }})
	)
		{
			alert("{{ info_sizelimit_text }}");
			return false;
		}
		return true;
	}
</script>
<form id="profileForm" method="post" action="{{ form_action }}" enctype="multipart/form-data">
<input type="hidden" name="token" value="{{ token }}"/>
<div class="form-wrap">
	<h1>{{ lang.uprofile['profile_of'] }}</h1>
	{% if pluginIsActive('xfields') %}{{ plugin_xfields_1 }}{% endif %}
	<div class="form-item clearfix">
		<label>{{ lang.uprofile['email'] }}:</label>
		<input type="text" name="editmail" value="{{ user.email }}" />
	</div>
	<div class="form-item clearfix">
		<label>{{ lang.uprofile['from'] }}:</label>
		<input type="text" name="editfrom" value="{{ user.from }}" />
	</div>
	<div class="form-textarea">
		<label>{{ lang.uprofile['about'] }}:</label>
		<textarea name="editabout" rows="5">{{ user.info }}</textarea>
	</div>
	{% if (info_sizelimit > 0) %}<div style="margin-top: 10px"><small>{{ lang.uprofile['sizelimit_min'] }}{about_sizelimit} {{ lang.uprofile['characters'] }}</small></div>{% endif %}
	<div class="form-item clearfix">
		<label>{{ lang.uprofile['new_pass'] }}:</label>
		<input type="password" name="editpassword" value="" />
	</div>
	<div class="form-item clearfix">
		<label>{{ lang.uprofile['oldpass'] }}:</label>
		<input type="password" name="oldpass" value="" />
		<div class="clr"></div>
		{{ lang.uprofile['oldpass#desc'] }}
	</div>
	{% if (flags.avatarAllowed) %}
		<div class="form-item clearfix">
			<label>{{ lang.uprofile['avatar'] }}:</label>
			<input type="file" name="newavatar" size="28" />
		</div>
		{% if (user.flags.hasAvatar) %}
			<div class="form-checks">
				<img src="{{ user.avatar }}" style="margin: 5px; border: 0px; max-width: 80px; max-height: 80px;" alt=""/>
				<div class="clr"></div>
				<input type="checkbox" name="delavatar" id="delavatar" />
				<label>{{ lang.uprofile['delete'] }}</label>
			</div>
		{% endif %}
	{% else %}
		<div class="form-item clearfix">
			<label>{{ lang.uprofile['avatar'] }}:</label>
			{{ lang.uprofile['avatars_denied'] }}
		</div>
	{% endif %}
	{% if pluginIsActive('xfields') %}{{ plugin_xfields_0 }}{% endif %}
	<div class="form-submit">
		<button type="submit">{{ lang.uprofile['save'] }}</button>
	</div>
</div>
</form>