{% extends localPath(0) ~ "site.body.tpl" %}
{% block content %}
	{% if (flags.link_news) %}
		<div class="box_info">
			<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 }}"/>
		<ul class="ui-form">
			{% for entry in entries %}
				{% if entry.type == 'text' %}
					<li class="form-group">
						<label>{{ entry.title }}</label>
						<input type="text" name="{{ entry.name }}" class="wide" required>
					</li>
				{% endif %}
				{% if entry.type == 'email' %}
					<li class="form-group">
						<label>{{ entry.title }}</label>
						<input type="text" name="{{ entry.name }}" class="wide" required>
					</li>
				{% endif %}
				{% if entry.type == 'textarea' %}
					<li class="form-group">
						<label>{{ entry.title }}</label>
						<textarea name="{{ entry.name }}" rows="8" class="wide" required>{{ entry.value }}</textarea>
					</li>
				{% endif %}
				{% if entry.type == 'select' %}
					<li class="form-group">
						<label>{{ entry.title }}</label>
						<select name="{{ entry.name }}" class="wide">{{ entry.options.select }}</select>
					</li>
				{% endif %}
				{% if entry.type == 'date' %}
					<li class="form-group">
						<label>{{ entry.title }}</label>
						<div style="width: 100%;"><select name="{{ entry.name }}:day" style="width: 33%;">{{ entry.options.day }}</select> <select name="{{ entry.name }}:month" style="width: 33%;">{{ entry.options.month }}</select> <select name="{{ entry.name }}:year" style="width: 33%;">{{ entry.options.year }}</select></div>
					</li>
				{% endif %}
			{% endfor %}
			{% if (flags.recipients) %}
				<li class="form-group">
					<label>{{ lang['feedback:sform.elist'] }}</label>
					<select name="recipient" class="wide">{{ recipients_list }}</select>
				</li>
			{% endif %}
			{% if (flags.captcha) %}
				<li class="form-group">
					<div class="c-captcha">
						<span><img id="img_captcha" onclick="this.src='{{ captcha_url }}&rand='+Math.random();" src="{{ captcha_url }}&rand={{ captcha_rand }}" style="background: #fff; cursor: pointer;" alt="Security code" /></span>
						<input placeholder="{{ lang.theme.code }}" title="{{ lang.theme.code_info }}" type="text" name="vcode" required>
					</div>
				</li>
			{% endif %}
		</ul>
		<div class="form_submit">
			<button {% if (flags.jcheck) %}onclick="return FBF_CHECK();" {% endif %}class="btn" type="submit">{{ lang.theme.send }}</button>
		</div>
	</form>
{% endblock %}