{include file="$gentemplates/$header_tpl"}
	<div style="width:100%;">
	<dl>
		<dd valign="top" style="padding-top:5px; padding-{$default_right}:0px; padding-bottom:10px; padding-{$default_left}:0px;">
			<h2>{if $sel eq 'edit'}{$lang.section.events}: {$lang.events.edit}{else}{$lang.section.events}: {$lang.events.add}{/if}</h2>
		</dd>
	</dl>
	{*if $form.err}
	<dl>
		<dd valign="top" style="padding: 5px 0px;"><font class="error_msg">*&nbsp;{$form.err}</font></dd>
	{/if*}
			<div class="content content_adult_2" style=" margin: 0px;">
			<div style="width:100%;">			
				<form name="event_form" id="event_form" action="{$site_root}/{$seo.events}?sel=add" method="post" enctype="multipart/form-data">
				<input type="hidden" name="region_id" id="region_id">
                <input type="hidden" name="city_id" id="city_id">
				<input type="hidden" name="id_event" id="id_event" value="{$data.id_event}">
					<div style="width:100%;">
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.event_name} <font class="error_msg">*</font>:</div>
						<div>
                            <input type="text" name="event_name" id="event_name" value="{$data.event_name}" style="width: 300px" maxlength="500" onkeyup="BadWords('event_name');"/>
                            <div id="bad_div_event_name" class="bad_div_left"></div>
                        </div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.type} <font class="error_msg">*</font>:</div>
						<div>
							<select style="width: 300px" name="type">
								<option value="0">{$lang.home_page.select_default}</option>
								{section name=s loop=$types}
								<option value="{$types[s].id}" {if $types[s].sel}selected="selected"{/if}>{$types[s].name}</option>
								{/section}
							</select>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="float_left checkbox_div">
							<input type="checkbox" name="members_can_invite" value="1" {if $data.can_invite eq '1'}checked="checked"{/if}>
							{$lang.events.members_can_invite}
						</div>					
						<div class="float_left">
							<input type="checkbox" name="members_can_post_images" value="1" {if $data.can_post_images eq '1'}checked="checked"{/if}>
							{$lang.events.members_can_post_images}
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.country} <font class="error_msg">*</font></div>
						<div>
							<select style="width: 150px" name="country" onchange="SelectRegion('qs', this.value, document.getElementById('region_div'), document.getElementById('city_div'));">
								<option value="0">{$lang.home_page.select_default}</option>
								{section name=s loop=$countries}
								<option value="{$countries[s].id}" {if $countries[s].sel}selected="selected"{/if}>{$countries[s].name}</option>
								{/section}
							</select>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.region} <font class="error_msg">*</font>:</div>
						<div>
							<div id="region_div">							
								<select style="width: 150px" name="region" id="region" onchange="SelectCity('qs', this.value, document.getElementById('city_div'));">
									<option value="0">{$lang.home_page.select_default}</option>
									{section name=s loop=$regions}
									<option value="{$regions[s].id}" {if $regions[s].sel}selected="selected"{/if}>{$regions[s].name}</option>
									{/section}
								</select>							
							</div>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.city} <font class="error_msg">*</font>:</div>
						<div>
							<div id="city_div">
							
							<select style="width: 150px" name="city" id="city">
								<option value="0">{$lang.home_page.select_default}</option>
								{section name=s loop=$cities}
								<option value="{$cities[s].id}" {if $cities[s].sel}selected="selected"{/if}>{$cities[s].name}</option>
								{/section}
							</select>
							
							</div>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.event_place} <font class="error_msg">*</font>:</div>
						<div>
                            <input type="text" onkeyup="BadWords('event_place');" id="event_place" name="event_place" value="{$data.event_place}" style="width: 295px" maxlength="500">
                            <div id="bad_div_event_place" class="bad_div_left"></div>
                        </div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.event_date_begin} <font class="error_msg">*</font>:</div>
						<div style="width: 300px">
							<div class="float_left" style="width:184px">
								<select name="s_day" style="width:45px;">
								{section name=d loop=$s_day}
									<option value="{$s_day[d].value}" {if $s_day[d].sel}selected="selected"{/if}>{$s_day[d].value}</option>
								{/section}
								</select>&nbsp;
								<select name="s_month" style="width:60px;" >
								{section name=m loop=$s_month}
									<option value="{$s_month[m].value}" {if $s_month[m].sel}selected="selected"{/if}>{$s_month[m].name}</option>
								{/section}
								</select>&nbsp;
								<select name="s_year" style="width:57px;" >
								{section name=y loop=$s_year}
									<option value="{$s_year[y].value}" {if $s_year[y].sel}selected="selected"{/if}>{$s_year[y].value}</option>
								{/section}
								</select>&nbsp;
							</div>
							<div class="float_left" style="width:14px">{$lang.events.event_period.at}</div>
							<div class="float_left" style="width:102px">
								<select name="s_hour" style="width:45px;" >
									{section name=h loop=$s_hour}
										<option value="{$s_hour[h].value}" {if $s_hour[h].sel}selected="selected"{/if}>{$s_hour[h].value}</option>
									{/section}
									</select>&nbsp;
									<select name="s_min" style="width:45px;" >
									{section name=i loop=$s_min}
										<option value="{$s_min[i].value}" {if $s_min[i].sel}selected="selected"{/if}>{$s_min[i].value}</option>
									{/section}
								</select>
							</div>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.event_date_end} <font class="error_msg">*</font>:</div>
						<div style="width: 300px">
							<div class="float_left" style="width:184px">
								<select name="f_day" style="width:45px;" >
								{section name=d loop=$f_day}
									<option value="{$f_day[d].value}" {if $f_day[d].sel}selected="selected"{/if}>{$f_day[d].value}</option>
								{/section}
								</select>&nbsp;
								<select name="f_month" style="width:60px;" >
								{section name=m loop=$f_month}
									<option value="{$f_month[m].value}" {if $f_month[m].sel}selected="selected"{/if}>{$f_month[m].name}</option>
								{/section}
								</select>&nbsp;
								<select name="f_year" style="width:57px;" >
								{section name=y loop=$f_year}
									<option value="{$f_year[y].value}" {if $f_year[y].sel}selected="selected"{/if}>{$f_year[y].value}</option>
								{/section}
								</select>&nbsp;								
							</div>
							<div class="float_left" style="width:14px">{$lang.events.event_period.at}</div>
							<div class="float_left" style="width:102px">
								<select name="f_hour" style="width:45px;" >
								{section name=h loop=$f_hour}
									<option value="{$f_hour[h].value}" {if $f_hour[h].sel}selected="selected"{/if}>{$f_hour[h].value}</option>
								{/section}
								</select>&nbsp;
								<select name="f_min" style="width:45px;" >
								{section name=i loop=$f_min}
									<option value="{$f_min[i].value}" {if $f_min[i].sel}selected="selected"{/if}>{$f_min[i].value}</option>
								{/section}
								</select>
							</div>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.event_periodicity}:</div>
						<div>
							<div class="float_left checkbox_div">
								<input type="radio" name="periodicity" value="none" {if $data.periodicity == "none"}checked="checked"{/if}> 
								{$lang.events.event_period.none}
							</div>
							<div class="float_left checkbox_div">
								<input type="radio" name="periodicity" value="daily" {if $data.periodicity == "daily"}checked="checked"{/if} > 
								{$lang.events.event_period.daily}
							</div>
							<div class="float_left checkbox_div">
								<input type="radio" name="periodicity" value="weekly" {if $data.periodicity == "weekly"}checked="checked"{/if} > 
								{$lang.events.event_period.weekly}
							</div>
							<div class="float_left checkbox_div">
								<input type="radio" name="periodicity" value="monthly" {if $data.periodicity == "monthly"}checked="checked"{/if} > 
								{$lang.events.event_period.monthly}
							</div>
							<div class="float_left checkbox_div">
								<input type="radio" name="periodicity" value="yearly" {if $data.periodicity == "yearly"}checked="checked"{/if} > 
								{$lang.events.event_period.yearly}
							</div>
							
							<div id="die_date" class="float_left" style="display:{if $data.periodicity == "none"}none{else}inline{/if}">
							{$lang.events.until}:&nbsp;
							<select name="d_day" style="width:45px;" >
								<option value="0" ></option>
								{section name=d loop=$d_day}
									<option value="{$d_day[d].value}" {if $d_day[d].sel}selected="selected"{/if}>{$d_day[d].value}</option>
								{/section}
							</select>&nbsp;
							<select name="d_month" style="width:60px;" >
								<option value="0" ></option>
								{section name=m loop=$d_month}
									<option value="{$d_month[m].value}" {if $d_month[m].sel}selected="selected"{/if}>{$d_month[m].name}</option>
								{/section}
							</select>&nbsp;
							<select name="d_year" style="width:60px;" >
								<option value="0" ></option>
								{section name=y loop=$d_year}
									<option value="{$d_year[y].value}" {if $d_year[y].sel}selected="selected"{/if}>{$d_year[y].value}</option>
								{/section}
							</select>&nbsp;
							</div>
						</div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">
							<dl><dd>{$lang.events.event_descr}:</dd></dl>
							{*<dl><dd class="text">{$lang.events.no_html}</dd></dl>*}
						</div>
						<div>
							{$redactor}
                            <textarea name="description" id="description" class="redactor_normal">{*$data.description*}</textarea>
                            <div id="bad_div_description" class="bad_div_left"></div>
                        </div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">
							<dl><dd>{$lang.events.flyer}:</dd></dl>
							<dl><dd class="text">{$lang.events.flyer_hint}</dd></dl>
						</div>
						<div><input type="file" name="flyer"></div>
					</div>
					<div class="form_edit_input">
						<div class="form_edit_input_text">{$lang.events.verification}:</div>
						<div>
							<img src="{$form.kcaptcha}" alt="{$lang.events.verification}">
							<br>
							<input type="text" style="width: 300px; margin: 8px 0 0;" name="keystring">
						</div>
					</div>
					<dl>
						<dd style="height:30" colspan="2"><input type="button" value="{$lang.button.save}" class="button" onclick="Save();"></dd>
					</dl>
					</div>
				</form>
			</div>
			</div>
	</div>
<script type="text/javascript">
{literal}
function Save() {
	$('#region_id').val($('#region').val());
	$('#city_id').val($('#city').val());
	document.event_form.submit();
}
{/literal}
</script>
{include file="$gentemplates/$footer_tpl"}