{% extends localPath(0) ~ "site.body.tpl" %}
{% block content %}
	{% if (flags.link_news) %}
		<div class="berrors">
			<b>Запрос по новости : <a href="{{ news.url }}">{{ news.title }}</a></b>
		</div>
	{% endif %}
	{{ description }}<br/><br/>
	{% if (flags.jcheck) %}
		<script language="JavaScript">
			var FBF_INIT = {{ FBF_DATA }};
			function FBF_CHECK() {
				var frm = document.getElementById('feedback_form');
				if (frm == null) return true;

				var i;
				for (i in FBF_INIT) {
					if (FBF_INIT[i][1]) {
						if (FBF_INIT[i][0] == 'date') {
							if ((frm[i + ':day'].value == '1') && (frm[i + ':month'].value == '1') && (frm[i + ':year'].value == '1970')) {
								alert('{l_feedback:form.err.notfilled} (' + FBF_INIT[i][2] + ')!');
								frm[i + ':day'].focus();
								return false;
							}
						} else if (frm[i].value == '') {
							alert('{l_feedback:form.err.notfilled} (' + FBF_INIT[i][2] + ')!');
							frm[i].focus();
							return false;
						}
					}
				}
				return true;
			}
		</script>
	{% endif %}
	<form method="post" action="{{ form_url }}" id="feedback_form" name="feedback_form">
		{{ hidden_fields }}
		<input type="hidden" name="id" value="{{ id }}"/>
		{% for entry in entries %}
			{% if entry.type == 'text' %}
				<div class="form-item clearfix">
					<label>{{ entry.title }}:</label>
					<input type="text" name="{{ entry.name }}" maxlength="35" />
				</div>
			{% endif %}
			{% if entry.type == 'email' %}
				<div class="form-item clearfix">
					<label>{{ entry.title }}:</label>
					<input type="text" name="{{ entry.name }}" maxlength="35" />
				</div>
			{% endif %}
			{% if entry.type == 'textarea' %}
				<div class="form-textarea" style="margin-bottom:20px;">
					<label>{{ entry.title }}:</label>
					<textarea name="{{ entry.name }}" style="height: 160px">{{ entry.value }}</textarea>
				</div>
			{% endif %}
			{% if entry.type == 'select' %}
				<div class="form-item clearfix">
					<label>{{ entry.title }}:</label>
					<select name="{{ entry.name }}">{{ entry.options.select }}</select>
				</div>
			{% endif %}
			{% if entry.type == 'date' %}
				<div class="form-item clearfix">
					<label>{{ entry.title }}:</label>
					<select name="{{ entry.name }}:day">{{ entry.options.day }}</select>. <select name="{{ entry.name }}:month">{{ entry.options.month }}</select>. <select name="{{ entry.name }}:year">{{ entry.options.year }}</select>
				</div>
			{% endif %}
		{% endfor %}
		{% if (flags.captcha) %}
			<div class="form-item clearfix imp">
				<label>{{ lang.theme.captcha_title }}</label>
				<div class="form-secur">
					<input type="text" name="vcode" placeholder="{{ lang.theme.captcha_text }}" maxlength="45" required /><img id="img_captcha" onclick="this.src='{{ captcha_url }}&rand='+Math.random();" src="{{ captcha_url }}&rand={{ captcha_rand }}" style="background: #fff; width: 120px; height: 35px; cursor: pointer;" alt="captcha" />
				</div>
			</div>
		{% endif %}
		{% if (flags.recipients) %}
			<div class="form-item clearfix">
				<label>{{ lang['feedback:sform.elist'] }}:</label>
				<select name="recipient">{{ recipients_list }}</select>
			</div>
		{% endif %}
		<div class="form-submit">
			<button {% if (flags.jcheck) %}onclick="return FBF_CHECK();" {% endif %}type="submit">{{ lang.theme.send }}</button>
		</div>
	</form>
{% endblock %}