{include file="$gentemplates/$header_tpl"}

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<!-- search form -->
	<tr>
		<td>
		{if $err eq 1}<font class="error_msg">*&nbsp;{$lang.err.no_searchname}</font><br>&nbsp;{/if}
		{if $err eq 2}<font class="error_msg">*&nbsp;{$lang.err.exist_searchname}</font><br>&nbsp;{/if}
		<form action="{$form.search_action}" method="post" name="search_form" style="margin: 0px;">
		{$form.search_hiddens}

		<div class="content" style="margin: 0px; padding: 12px;">
			<div>
			<table cellspacing=0 cellpadding=0 border="0" width="100%">
				<tr>
					<td colspan=2><div class="header">{$lang.section.a_search}</div></td>
				</tr>
				<tr>
					<td colspan="2" style="padding-top: 5px;">{$lang.advanced_search.help_tip.main_text}</td>
				</tr>
				<tr>
					<td width="50%" valign="top">{strip}
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td height="30" class="text">
									<table cellspacing="0" cellpadding="0" border="0">
										<tr>
											<td>
												<table  cellspacing="0" cellpadding="0" border="0">
													<tr>
														<td style="padding-top: 5px;" class="text_head">{$lang.home_page.seeking_a_big}&nbsp;</td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td style="padding-top: 5px;" colspan=0>
												<div id="looking_user_subtype_div" style="position: relative; top: 0px">
													{if $looking_user_types_val}
														<table cellspacing="0" cellpadding="0" border="0">
															<tr>
																{foreach item=item name=looking_user_types_val from=$looking_user_types_val}
																	<td><input type="checkbox" name = "id_looking_user_subtypes[{$item.id}]" id = "id_looking_user_types[{$item.id}]" value="{$item.id}" {if $item.sel eq 1}checked{/if}></td><td><label for= "id_looking_user_types[{$item.id}]" >{$item.name}</label></td>
																	{if $smarty.foreach.looking_user_types_val.iteration is div by 3}
																		</tr>
																		<tr>
																	{/if}
																{/foreach}
															</tr>
														</table>
													{/if}
												</div>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td style="padding-top: 15px;" class="text_head">{$lang.home_page.looking_for}</td>
							</tr>
							<tr>
								<td style="padding-top: 2px;">
									<select class="index_select" name="relation[]" {if $data.root eq 1}disabled{/if} multiple style="width: 230px;" size="5">
										<option value="0" {if $relation.sel_all}selected="selected"{/if}>{$lang.button.all}</option>
										{html_options values=$relation.opt_value selected=$relation.opt_sel output=$relation.opt_name}
									</select>
								</td>
							</tr>
						</table>
					</td>
					<td width="50%" valign="top">
						<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td style="padding-top: 15px;" class="text_head">{$lang.home_page.between_the_ages_of}</td>
							</tr>
							<tr>
								<td style="padding-top: 2px;">
									<table cellpadding="0" cellspacing="0">
										<td>
											<select class="index_select" style="width: 50px" name="age_min">
												{section name=a loop=$age_min}
													<option value="{$age_min[a]}"  {if $data.age_min eq $age_min[a]}selected="selected"{/if}>{$age_min[a]}</option>
												{/section}
											</select>
										</td>
										<td class="text">
											&nbsp;&nbsp;{$lang.home_page.and}&nbsp;&nbsp;
										</td>
										<td>
											<select class="index_select" style="width: 50px" name="age_max">
												{section name=a loop=$age_max}
													<option value="{$age_max[a]}" {if $data.age_max eq $age_max[a]}selected="selected"{/if}>{$age_max[a]}</option>
												{/section}
											</select>
										</td>
									</table>
								</td>
							</tr>
							<tr>
								<td style="padding-top: 10px;" class="text_head">{$header_perfect.country}</td>
							</tr>
							<tr>
								<td style="padding-top: 2px;">
									<select class="index_select" name="id_country"  style="width:150px" onchange="SelectRegion('as', this.value, document.getElementById('region_div'), document.getElementById('city_div'));">
										<option value="0">{$lang.button.all}</option>
										{section name=s loop=$country_match}
											<option value="{$country_match[s].id}" {if $country_match[s].sel}selected="selected"{/if}>{$country_match[s].value}</option>
										{/section}
									</select>
								</td>
							</tr>
							<tr>
								<td style="padding-top: 3px;" class="text_head">{$header_perfect.region}</td>
							</tr>
							<tr>
								<td style="padding-top: 2px;">
									<div id="region_div">
										{if isset($region_match)}
											<select class="index_select" name="id_region"  style="width:150px" onchange="SelectCity('as', this.value, document.getElementById('city_div'));">
												<option value="0">{$lang.button.all}</option>
												{section name=s loop=$region_match}
													<option value="{$region_match[s].id}" {if $region_match[s].sel}selected="selected"{/if}>{$region_match[s].value}</option>
												{/section}
											</select>
										{else}
											<select class="index_select" name="id_region" style="width:150px;">
												<option value="0">{$lang.button.all}</option>
											</select>
										{/if}
									</div>
								</td>
							</tr>
							<tr>
								<td style="padding-top: 3px;" class="text_head">{$header_perfect.city}</td>
							</tr>
							<tr>
								<td style="padding-top: 2px;">
									<div id="city_div">
										{if isset($city_match)}
											<select class="index_select" name="id_city"   style="width:150px">
												<option value="0">{$lang.button.all}</option>
												{section name=s loop=$city_match}
													<option value="{$city_match[s].id}" {if $city_match[s].sel}selected="selected"{/if}>{$city_match[s].value}</option>
												{/section}
											</select>&nbsp;
										{else}
											<select class="index_select" name="id_city" style="width:150px;">
												<option value="0">{$lang.button.all}</option>
											</select>
										{/if}
									</div>
								</td>
							</tr>
							<tr>
								<td style="padding-top: 10px;">
									<table cellpadding="0" cellspacing="0">
										<tr>
											<td><font class="text_head">{$header_s.within}</font></td>
											<td style="padding-{$default_left}: 5px;"><input type="checkbox" name="within" value="1" {if $data.within eq 1}checked{/if} onclick="javascript: if (distance.disabled) distance.disabled = false; else distance.disabled = true;"></td>
											<td style="padding-{$default_left}: 3px;">
												<select class="index_select" id="distance" name="distance" {if $data.within eq 0}disabled{/if}>
													{section name=d loop=$distances}
														<option value="{$distances[d].id}" {if $data.distance eq $distances[d].id}selected="selected"{/if}>{$distances[d].name}&nbsp;{$distances[d].type}</option>
													{/section}
												</select>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				{/strip}
			</table>
			<table cellpadding="0" cellspacing="0" width="100%" style="margin: 12px 0px;">
				<tr>
					<td valign="top" height="1" class="home_search"></td>
				</tr>
			</table>
			<!--height\weight\nationality\lang-->
			{strip}
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
				<td width="50%" valign="top" style="padding-top: 5px;">
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
					<td class="text_head">{$header_perfect.weight}</td>
					</tr>
					<tr>
					<td style="padding-top: 2px;">
						<select name="id_weight"  style="width: 200px" class="index_select">
						<option value="0">{$lang.home_page.select_default}</option>
						{section name=s loop=$weight}
						<option value="{$weight[s].id}" {if $weight[s].sel}selected="selected"{/if}>{$weight[s].value}</option>
						{/section}
						</select>
					</td>
					</tr>
					</table>
				</td>
				<td width="50%" valign="top" style="padding-top: 5px;">
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
					<td class="text_head">{$header_perfect.height}</td>
					</tr>
					<tr>
					<td style="padding-top: 2px;">
						<select name="id_height"  style="width: 200px" class="index_select">
						<option value="0">{$lang.home_page.select_default}</option>
						{section name=s loop=$height}
						<option value="{$height[s].id}" {if $height[s].sel}selected="selected"{/if}>{$height[s].value}</option>
						{/section}
						</select>
					</td>
					</tr>
					</table>
				</td>
				</tr>
				<tr>
				<td width="50%" valign="top" style="padding-top: 10px;">
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
					<td class="text_head">{$header_perfect.nationality}</td>
					</tr>
					<tr>
					<td style="padding-top: 2px;">
						<select class="index_select" name="id_nation[]" multiple style="width: 200px;" class="index_select" size="5">
						<option value="0" {if $default.id_nation}selected="selected"{/if}>{$lang.button.all}</option>
						{section name=s loop=$nation_match}
						<option value="{$nation_match[s].id}" {if $nation_match[s].sel}selected="selected"{/if}>{$nation_match[s].value}</option>
						{/section}
						</select>
					</td>
					</tr>
					</table>
				</td>
				<td width="50%" style="padding-top: 10px;">
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
					<td class="text_head">{$header_perfect.language}</td>
					</tr>
					<tr>
					<td style="padding-top: 2px;">
						<select class="index_select" name="id_lang[]" multiple style="width:200px;" class="index_select" size="5">
						<option value="0" {if $default.id_lang}selected="selected"{/if}>{$lang.button.all}</option>
						{section name=s loop=$lang_sel_match}
						<option value="{$lang_sel_match[s].id}"{if $lang_sel_match[s].sel} selected="selected"{/if}>{$lang_sel_match[s].value}</option>
						{/section}
						</select>
					</td>
					</tr>
					</table>
				</td>
				</tr>
			</table>{/strip}
			<!--\\\height\weight\nationality\lang-->
			<table cellpadding="0" cellspacing="0" width="100%" style="margin-top:12px; margin-{$default_right}:0px; margin-bottom:5px; margin-{$default_left}:0px;">
			<tr>
				<td valign="top" height="1" class="home_search"></td>
			</tr>
			</table>
			{strip}<!-- references -->
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
			{section name=f loop=$info}
			<tr>
			<td width="25%" valign="top" style="padding-top: 10px;">
				<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td class="text_head">{$info[f].name_1}<input type="hidden" name="spr[{$info[f].num_1}]" value="{$info[f].id_1}"></td>
				</tr>
				<tr>
				<td style="padding-top: 2px;">
				<select class="index_select" id="info{$info[f].num_1}" name="info[{$info[f].num_1}][]" multiple style="width:167px;" class="index_select" size="5">
					<option value="0" {if $info[f].sel_all_1}selected="selected"{/if}>{$lang.button.all}</option>
					{html_options values=$info[f].opt_value_1 selected=$info[f].opt_sel_1 output=$info[f].opt_name_1}
				</select>
				</td>
				</tr>
				</table>
			</td>
			<td width="25%" valign="top" style="padding-top: 10px;">
				<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td class="text_head">{if $info[f].name_2}{$info[f].name_2}<input type="hidden" name="spr[{$info[f].num_2}]" value="{$info[f].id_2}">{/if}</td>
				</tr>
				<tr>
				<td style="padding-top: 2px;">
				{if $info[f].name_2}
				<select class="index_select" id="info{$info[f].num_2}" name="info[{$info[f].num_2}][]" multiple  style="width:167px;" class="index_select" size="5">
					<option value="0" {if $info[f].sel_all_2}selected="selected"{/if}>{$lang.button.all}</option>
					{html_options values=$info[f].opt_value_2 selected=$info[f].opt_sel_2 output=$info[f].opt_name_2}
				</select>{/if}
				</td>
				</tr>
				</table>
			</td>
			<td width="25%" valign="top" style="padding-top: 10px;">
				<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td class="text_head">{if $info[f].name_3}{$info[f].name_3}<input type="hidden" name="spr[{$info[f].num_3}]" value="{$info[f].id_3}">{/if}</td>
				</tr>
				<tr>
				<td style="padding-top: 2px;">
				{if $info[f].name_3}
				<select class="index_select" id="info{$info[f].num_3}" name="info[{$info[f].num_3}][]" multiple  style="width:167px;" class="index_select" size="5">
					<option value="0" {if $info[f].sel_all_3}selected="selected"{/if}>{$lang.button.all}</option>
					{html_options values=$info[f].opt_value_3 selected=$info[f].opt_sel_3 output=$info[f].opt_name_3}
				</select>{/if}
				</td>
				</tr>
				</table>
			</td>
			<td width="25%" valign="top" style="padding-top: 10px;">
				<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td class="text_head">{if $info[f].name_4}{$info[f].name_4}<input type="hidden" name="spr[{$info[f].num_4}]" value="{$info[f].id_4}">{/if}</td>
				</tr>
				<tr>
				<td style="padding-top: 2px;">
				{if $info[f].name_4}
				<select class="index_select" id="info{$info[f].num_4}" name="info[{$info[f].num_4}][]" multiple  style="width:167px;" class="index_select" size="5">
					<option value="0" {if $info[f].sel_all_4}selected="selected"{/if}>{$lang.button.all}</option>
					{html_options values=$info[f].opt_value_4 selected=$info[f].opt_sel_4 output=$info[f].opt_name_4}
				</select>{/if}
				</td>
				</tr>
				</table>
			</td>
			</tr>
			{/section}
			{/strip}<!--//refeneces-->
			<!-- bottom -->{strip}
			<tr>
			<td style="padding-bottom: 15px; padding-top: 5px;">
				<table cellpadding="0" cellspacing="0">
				<tr>
					<td><input type="checkbox" name="foto_only" value="1" {if $data.foto_only eq 1}checked{/if}></td>
					<td class="text_head">{$header_s.foto}</td>
				</tr>
				</table>
			</td>
			<td style="padding-bottom: 15px; padding-top: 5px;">
				<table cellpadding="0" cellspacing="0">
				<tr>
					<td><input type="checkbox" name="online_only" value="1" {if $data.online_only eq 1}checked{/if}></td>
					<td class="text_head">{$header_s.online}</td>
				</tr>
				</table>
			</td>
			<td colspan=2 style="padding: 15px 0px;" align="{$default_right}"><input type="button" class="big_button" onclick="javascript: document.search_form.submit();" value="{$lang.button.search}"></td>
			</tr>
			</table>{/strip}
			<!--// bottom -->
			</div>
		</div>
		{strip}<!-- save\load form-->
		<table width="100%" cellpadding="0" cellspacing="0">
		<tr><td align="{$default_left}" style="width: 50%;" valign="top">
			<!--save criteria form-->
			<div class="content" style="margin-top: 10px; padding-bottom: 10px;">
			<div class="header">{$lang.section.a_searchsave_header}</div>
			<div style="padding-top:15px; padding-{$default_right}:10px; padding-bottom:5px; padding-{$default_left}:10px;">
				<table border="0" cellspacing="0" cellpadding="0">
				<tr>
				<td valign="middle" align="{$default_left}"><input type="text" name="search_name" value="{if $data.search_name==''}{$lang.advanced_search.my_custom_search}{/if}{$data.search_name}" style="width: 165px" maxlength="100" class="index_input"></td>
				<td valign="middle" style="padding-{$default_left}: 10px;"><input type="button" class="index_btn" onclick="javascript:document.search_form.sel.value='save';document.search_form.submit();" value="{$lang.button.save}"></td>
				</tr>
				</table>
			</div>
			</div>
			<!-- /save criteria form-->
		</td>
		<td align="{$default_left}" style="padding-{$default_left}: 10px; width: 50%; " valign="top">
			<!--load criteria form-->
			<div class="content" style="margin-top: 10px; padding-bottom: 10px;">
			<div class="header">{$lang.section.a_searchload_header}</div>
			<div style="padding-top:15px; padding-{$default_right}:10px; padding-bottom:5px; padding-{$default_left}:10px;">
				<table border="0" cellspacing="0" cellpadding="0">
				<tr>
				<td align="{$default_left}" valign="middle">
					<select class="index_select" name="load_id" style="width: 165px;">
					<option value="0">{$lang.home_page.select_default}</option>
					{html_options values=$load_id output=$load_name}
					</select>
				</td>
				<td valign="middle" style="padding-{$default_left}: 10px;"><input type="button" class="index_btn" onclick="document.search_form.sel.value='load';document.search_form.submit();" value="{$lang.button.load}"></td>
				<td valign="middle" style="padding-{$default_left}: 5px;"><input type="button" class="index_btn" onclick="javascript: document.search_form.submit(document.search_form.sel.value='delete')" value="{$lang.button.delete}"></td>
				</tr>
				</table>
			</div>
			</div>
			<!-- /load criteria form-->
		</td></tr>
		</table>
		<!-- //save\load form-->
		{/strip}
	</form>
	</td></tr>
	<!-- /search form -->
	</table>
{include file="$gentemplates/$footer_tpl"}